You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-11-03 17:13:17 +03:00
chore(rbo,QA): fixed recursive application of the rule.
This commit is contained in:
@@ -219,7 +219,6 @@ std::optional<details::FilterRangeBounds<T>> populateRangeBounds(Histogram_json_
|
|||||||
{
|
{
|
||||||
details::FilterRangeBounds<T> bounds;
|
details::FilterRangeBounds<T> bounds;
|
||||||
|
|
||||||
|
|
||||||
// TODO configurable parallel factor via session variable
|
// TODO configurable parallel factor via session variable
|
||||||
// NB now histogram size is the way to control parallel factor with 16 being the maximum
|
// NB now histogram size is the way to control parallel factor with 16 being the maximum
|
||||||
std::cout << "populateRangeBounds() columnStatistics->buckets.size() "
|
std::cout << "populateRangeBounds() columnStatistics->buckets.size() "
|
||||||
@@ -481,7 +480,7 @@ bool applyParallelCES(execplan::CalpontSelectExecutionPlan& csep, optimizer::RBO
|
|||||||
execplan::CalpontSelectExecutionPlan::TableList newTableList;
|
execplan::CalpontSelectExecutionPlan::TableList newTableList;
|
||||||
// TODO support CSEPs with derived tables
|
// TODO support CSEPs with derived tables
|
||||||
execplan::CalpontSelectExecutionPlan::SelectList newDerivedTableList;
|
execplan::CalpontSelectExecutionPlan::SelectList newDerivedTableList;
|
||||||
bool ruleHasBeenApplied = false;
|
bool ruleMustBeApplied = false;
|
||||||
optimizer::TableAliasToNewAliasAndSCPositionsMap tableAliasToSCPositionsMap;
|
optimizer::TableAliasToNewAliasAndSCPositionsMap tableAliasToSCPositionsMap;
|
||||||
|
|
||||||
// 1st pass over tables to create derived tables placeholders to collect
|
// 1st pass over tables to create derived tables placeholders to collect
|
||||||
@@ -501,10 +500,7 @@ bool applyParallelCES(execplan::CalpontSelectExecutionPlan& csep, optimizer::RBO
|
|||||||
tableAliasToSCPositionsMap.insert({table, {tableAlias, {}, 0}});
|
tableAliasToSCPositionsMap.insert({table, {tableAlias, {}, 0}});
|
||||||
execplan::CalpontSystemCatalog::TableAliasName tn = execplan::make_aliasview("", "", tableAlias, "");
|
execplan::CalpontSystemCatalog::TableAliasName tn = execplan::make_aliasview("", "", tableAlias, "");
|
||||||
newTableList.push_back(tn);
|
newTableList.push_back(tn);
|
||||||
|
ruleMustBeApplied = true;
|
||||||
// auto derivedSCEP = createDerivedTableFromTable(csep, table, tableAlias, ctx);
|
|
||||||
// newDerivedTableList.push_back(std::move(derivedSCEP));
|
|
||||||
// ruleHasBeenApplied = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -512,10 +508,10 @@ bool applyParallelCES(execplan::CalpontSelectExecutionPlan& csep, optimizer::RBO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2nd pass over RCs to update RCs with derived table SCs
|
// 2nd pass over RCs to update RCs with derived table SCs in projection
|
||||||
execplan::CalpontSelectExecutionPlan::ReturnedColumnList newReturnedColumns;
|
execplan::CalpontSelectExecutionPlan::ReturnedColumnList newReturnedColumns;
|
||||||
// replace parent CSEP RCs with derived table RCs using ScheamAndTableName -> tableAlias map
|
// replace parent CSEP RCs with derived table RCs using ScheamAndTableName -> tableAlias map
|
||||||
if (!newDerivedTableList.empty())
|
if (ruleMustBeApplied)
|
||||||
{
|
{
|
||||||
std::cout << "Iterating over RCs" << std::endl;
|
std::cout << "Iterating over RCs" << std::endl;
|
||||||
for (auto& rc : csep.returnedCols())
|
for (auto& rc : csep.returnedCols())
|
||||||
@@ -627,7 +623,6 @@ bool applyParallelCES(execplan::CalpontSelectExecutionPlan& csep, optimizer::RBO
|
|||||||
auto derivedSCEP =
|
auto derivedSCEP =
|
||||||
createDerivedTableFromTable(csep, table, newTableAlias, ctx, extraSCsAndTheirPositions);
|
createDerivedTableFromTable(csep, table, newTableAlias, ctx, extraSCsAndTheirPositions);
|
||||||
newDerivedTableList.push_back(std::move(derivedSCEP));
|
newDerivedTableList.push_back(std::move(derivedSCEP));
|
||||||
ruleHasBeenApplied = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -641,7 +636,7 @@ bool applyParallelCES(execplan::CalpontSelectExecutionPlan& csep, optimizer::RBO
|
|||||||
csep.tableList(newTableList);
|
csep.tableList(newTableList);
|
||||||
csep.returnedCols(newReturnedColumns);
|
csep.returnedCols(newReturnedColumns);
|
||||||
}
|
}
|
||||||
return ruleHasBeenApplied;
|
return ruleMustBeApplied;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace optimizer
|
} // namespace optimizer
|
||||||
|
|||||||
@@ -98,16 +98,6 @@ bool Rule::walk(execplan::CalpontSelectExecutionPlan& csep, optimizer::RBOptimiz
|
|||||||
execplan::CalpontSelectExecutionPlan* current = planStack.top();
|
execplan::CalpontSelectExecutionPlan* current = planStack.top();
|
||||||
planStack.pop();
|
planStack.pop();
|
||||||
|
|
||||||
// Walk nested derived
|
|
||||||
for (auto& table : current->derivedTableList())
|
|
||||||
{
|
|
||||||
auto* csepPtr = dynamic_cast<execplan::CalpontSelectExecutionPlan*>(table.get());
|
|
||||||
if (csepPtr)
|
|
||||||
{
|
|
||||||
planStack.push(csepPtr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Walk nested UNION UNITS
|
// Walk nested UNION UNITS
|
||||||
for (auto& unionUnit : current->unionVec())
|
for (auto& unionUnit : current->unionVec())
|
||||||
{
|
{
|
||||||
@@ -118,7 +108,7 @@ bool Rule::walk(execplan::CalpontSelectExecutionPlan& csep, optimizer::RBOptimiz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Walk nested subselect in filters, e.g. SEMI-JOIN
|
// Walk nested subselect in filters, e.g. SEMI-JOIN and also derived tables
|
||||||
for (auto& subselect : current->subSelectList())
|
for (auto& subselect : current->subSelectList())
|
||||||
{
|
{
|
||||||
auto* subselectPtr = dynamic_cast<execplan::CalpontSelectExecutionPlan*>(subselect.get());
|
auto* subselectPtr = dynamic_cast<execplan::CalpontSelectExecutionPlan*>(subselect.get());
|
||||||
|
|||||||
Reference in New Issue
Block a user