Java Code Examples for org.apache.calcite.plan.RelTrait#getTraitDef()
The following examples show how to use
org.apache.calcite.plan.RelTrait#getTraitDef() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VolcanoPlanner.java From Bats with Apache License 2.0 | 6 votes |
public boolean removeRule(RelOptRule rule) { if (!ruleSet.remove(rule)) { // Rule was not present. return false; } // Remove description. unmapRuleDescription(rule); // Remove operands. classOperands.values().removeIf(entry -> entry.getRule().equals(rule)); // Remove trait mappings. (In particular, entries from conversion // graph.) if (rule instanceof ConverterRule) { ConverterRule converterRule = (ConverterRule) rule; final RelTrait ruleTrait = converterRule.getInTrait(); final RelTraitDef ruleTraitDef = ruleTrait.getTraitDef(); if (traitDefs.contains(ruleTraitDef)) { ruleTraitDef.deregisterConverterRule(this, converterRule); } } return true; }
Example 2
Source File: VolcanoPlanner.java From calcite with Apache License 2.0 | 6 votes |
public boolean removeRule(RelOptRule rule) { // Remove description. if (!super.removeRule(rule)) { // Rule was not present. return false; } // Remove operands. classOperands.values().removeIf(entry -> entry.getRule().equals(rule)); // Remove trait mappings. (In particular, entries from conversion // graph.) if (rule instanceof ConverterRule) { ConverterRule converterRule = (ConverterRule) rule; final RelTrait ruleTrait = converterRule.getInTrait(); final RelTraitDef ruleTraitDef = ruleTrait.getTraitDef(); if (traitDefs.contains(ruleTraitDef)) { ruleTraitDef.deregisterConverterRule(this, converterRule); } } return true; }
Example 3
Source File: VolcanoPlanner.java From calcite with Apache License 2.0 | 5 votes |
public boolean addRule(RelOptRule rule) { if (locked) { return false; } if (!super.addRule(rule)) { return false; } // Each of this rule's operands is an 'entry point' for a rule call. // Register each operand against all concrete sub-classes that could match // it. for (RelOptRuleOperand operand : rule.getOperands()) { for (Class<? extends RelNode> subClass : subClasses(operand.getMatchedClass())) { if (PhysicalNode.class.isAssignableFrom(subClass) && rule instanceof TransformationRule) { continue; } classOperands.put(subClass, operand); } } // If this is a converter rule, check that it operates on one of the // kinds of trait we are interested in, and if so, register the rule // with the trait. if (rule instanceof ConverterRule) { ConverterRule converterRule = (ConverterRule) rule; final RelTrait ruleTrait = converterRule.getInTrait(); final RelTraitDef ruleTraitDef = ruleTrait.getTraitDef(); if (traitDefs.contains(ruleTraitDef)) { ruleTraitDef.registerConverterRule(this, converterRule); } } return true; }
Example 4
Source File: VolcanoPlannerTraitTest.java From calcite with Apache License 2.0 | 5 votes |
private AltTraitConverter( RelOptCluster cluster, RelNode child, RelTrait toTrait) { super( cluster, toTrait.getTraitDef(), child.getTraitSet().replace(toTrait), child); this.toTrait = toTrait; }