1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

feat(optimizer): into derived CSEP rewrite with hardcoded tables

This commit is contained in:
drrtuy
2025-06-13 20:08:13 +00:00
parent 1baaf878d0
commit e07e85b750

View File

@ -9260,7 +9260,7 @@ void applyParallelCES(CalpontSelectExecutionPlan& csep)
auto tables = csep.tableList();
CalpontSelectExecutionPlan::TableList newTableList;
CalpontSelectExecutionPlan::SelectList newDerivedTableList;
static const std::string aliasPrefix = "subQ";
static const std::string aliasPrefix = "$sub_";
// ATM Must be only 1 table
for (auto& table: tables)
@ -9268,6 +9268,7 @@ void applyParallelCES(CalpontSelectExecutionPlan& csep)
if (!table.isColumnstore())
{
auto derivedSCEP = csep.cloneWORecursiveSelects();
// need to intro a level
std::string alias = aliasPrefix + table.schema + "_" + table.table;
derivedSCEP->location(CalpontSelectExecutionPlan::FROM);
@ -9287,11 +9288,10 @@ void applyParallelCES(CalpontSelectExecutionPlan& csep)
sc->tableName("");
sc->schemaName("");
sc->tableAlias(alias);
sc->colPosition(0);
}
}
// WIP need to work with existing derived tables
newDerivedTableList.push_back(derivedSCEP);
// WIP
@ -9300,6 +9300,14 @@ void applyParallelCES(CalpontSelectExecutionPlan& csep)
}
}
// SimpleColumn* sc = new SimpleColumn("test", "i1", "i", false, csep.sessionID());
// string alias(table->alias.c_ptr());
// sc->timeZone(csep.timeZone());
// sc->partitions(getPartitions(table));
// boost::shared_ptr<SimpleColumn> spsc(sc);
// csep.columnMap().insert({"`test`.`i1`.`i`", spsc});
csep.derivedTableList(newDerivedTableList);
csep.tableList(newTableList);
}
@ -9402,7 +9410,7 @@ int cs_get_select_plan(ha_columnstore_select_handler* handler, THD* /*thd*/, SCS
cerr << "---------------- cs_get_select_plan rewritten EXECUTION PLAN ----------------" << endl;
cerr << *csep << endl;
cerr << "-------------- EXECUTION PLAN END --------------\n" << endl;
return 0;
}