1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-10-31 18:30:33 +03:00

chore(rbo): MCOL-6143: Settle down rbo as a separate lib for Unittesting (#3708)

* fix builds

* MCOL-6143: rbo as a separate library

* Move get_unstable_optimizer out of rbo, move findStatisticsForATable to header bo be (dirty fix, but cuts the corner)

* Add some helpers to a headerfile for unittesting

* Simple unittests with some mocks
This commit is contained in:
Leonid Fedorov
2025-08-15 15:28:28 +04:00
committed by GitHub
parent 08d89fcef7
commit 14fe4401bc
15 changed files with 671 additions and 83 deletions

View File

@@ -5222,7 +5222,7 @@ void extractColumnStatistics(TABLE_LIST* table_ptr, gp_walk_info& gwi)
auto* histogram = dynamic_cast<Histogram_json_hb*>(field->read_stats->histogram);
if (histogram)
{
std::cout << " has stats with " << histogram->buckets.size() << " buckets";
std::cout << " has stats with " << histogram->get_json_histogram().size() << " buckets";
SchemaAndTableName tableName = {field->table->s->db.str, field->table->s->table_name.str};
auto sc =
std::unique_ptr<execplan::SimpleColumn>(buildSimpleColumnFromFieldForStatistics(field, gwi));
@@ -7596,12 +7596,11 @@ int cs_get_select_plan(ha_columnstore_select_handler* handler, THD* thd, SCSEP&
// Derived table projection list optimization.
derivedTableOptimization(&gwi, csep);
{
optimizer::RBOptimizerContext ctx(gwi, *thd, csep->traceOn());
// TODO RBO can crash or fail leaving CSEP in an invalid state, so there must be a valid CSEP copy
// TBD There is a tradeoff b/w copy per rule and copy per optimizer run.
bool csepWasOptimized = optimizer::optimizeCSEP(*csep, ctx);
bool csepWasOptimized = optimizer::optimizeCSEP(*csep, ctx, get_unstable_optimizer(&ctx.thd));
if (csep->traceOn() && csepWasOptimized)
{
cerr << "---------------- cs_get_select_plan optimized EXECUTION PLAN ----------------" << endl;