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

feat(optimizer): rewrite rule does not descent into a freshly created UNION unit.

This commit is contained in:
drrtuy
2025-06-23 22:17:09 +00:00
parent 464b9a1ca3
commit 3bf4394456
2 changed files with 40 additions and 22 deletions

View File

@@ -24,13 +24,24 @@ namespace optimizer {
struct Rule
{
Rule(std::string&& name, bool (*matchRule)(execplan::CalpontSelectExecutionPlan&),
void (*applyRule)(execplan::CalpontSelectExecutionPlan&))
using RuleMatcher = bool (*)(execplan::CalpontSelectExecutionPlan&);
using RuleApplier = void (*)(execplan::CalpontSelectExecutionPlan&);
Rule(std::string&& name, RuleMatcher matchRule, RuleApplier applyRule)
: name(name), matchRule(matchRule), applyRule(applyRule) {};
std::string name;
bool (*matchRule)(execplan::CalpontSelectExecutionPlan&);
void (*applyRule)(execplan::CalpontSelectExecutionPlan&);
RuleMatcher matchRule;
RuleApplier applyRule;
// TODO Wrap CSEP into Nodes to be able to navigate up and down the tree and remove this flag
bool applyOnlyOnce = true;
Rule() = default;
Rule(const Rule&) = default;
Rule(Rule&&) = default;
Rule& operator=(const Rule&) = default;
Rule& operator=(Rule&&) = default;
bool apply(execplan::CalpontSelectExecutionPlan& csep) const;
bool walk(execplan::CalpontSelectExecutionPlan& csep) const;
};