use of org.apache.calcite.rel.convert.TraitMatchingRule in project calcite by apache.
the class HepPlanner method executeInstruction.
void executeInstruction(HepInstruction.ConverterRules instruction) {
assert currentProgram.group == null;
if (instruction.ruleSet == null) {
instruction.ruleSet = new LinkedHashSet<>();
for (RelOptRule rule : allRules) {
if (!(rule instanceof ConverterRule)) {
continue;
}
ConverterRule converter = (ConverterRule) rule;
if (converter.isGuaranteed() != instruction.guaranteed) {
continue;
}
// Add the rule itself to work top-down
instruction.ruleSet.add(converter);
if (!instruction.guaranteed) {
// Add a TraitMatchingRule to work bottom-up
instruction.ruleSet.add(new TraitMatchingRule(converter, RelFactories.LOGICAL_BUILDER));
}
}
}
applyRules(instruction.ruleSet, instruction.guaranteed);
}
Aggregations