Java Code Examples for org.apache.calcite.plan.RelOptRule#getOperands()
The following examples show how to use
org.apache.calcite.plan.RelOptRule#getOperands() .
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 calcite with Apache License 2.0 | 6 votes |
@Override protected void onNewClass(RelNode node) { super.onNewClass(node); final boolean isPhysical = node instanceof PhysicalNode; // Create mappings so that instances of this class will match existing // operands. final Class<? extends RelNode> clazz = node.getClass(); for (RelOptRule rule : mapDescToRule.values()) { if (isPhysical && rule instanceof TransformationRule) { continue; } for (RelOptRuleOperand operand : rule.getOperands()) { if (operand.getMatchedClass().isAssignableFrom(clazz)) { classOperands.put(clazz, operand); } } } }
Example 2
Source File: VolcanoPlanner.java From Bats with Apache License 2.0 | 5 votes |
@Override protected void onNewClass(RelNode node) { super.onNewClass(node); // Create mappings so that instances of this class will match existing // operands. final Class<? extends RelNode> clazz = node.getClass(); for (RelOptRule rule : ruleSet) { for (RelOptRuleOperand operand : rule.getOperands()) { if (operand.getMatchedClass().isAssignableFrom(clazz)) { classOperands.put(clazz, operand); } } } }
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; }