org.apache.calcite.adapter.enumerable.EnumerableUnion Java Examples
The following examples show how to use
org.apache.calcite.adapter.enumerable.EnumerableUnion.
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: VolcanoPlannerTest.java From calcite with Apache License 2.0 | 6 votes |
@Test void testMultiInputsParentOpMatching() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); RelOptCluster cluster = newCluster(planner); // The trigger rule that generates PhysLeafRel from NoneLeafRel planner.addRule(new PhysLeafRule()); // The rule with third child op matching PhysLeafRel, which should not be // matched at all planner.addRule(new ThreeInputsUnionRule()); // Construct a union with only two children NoneLeafRel leftRel = new NoneLeafRel(cluster, "b"); RelNode leftPhy = planner .changeTraits(leftRel, cluster.traitSetOf(PHYS_CALLING_CONVENTION)); PhysLeafRel rightPhy = new PhysLeafRel(cluster, PHYS_CALLING_CONVENTION, "b"); planner.setRoot( new EnumerableUnion(cluster, cluster.traitSetOf(PHYS_CALLING_CONVENTION), Arrays.asList(leftPhy, rightPhy), false)); planner.chooseDelegate().findBestExp(); }
Example #2
Source File: CalcitePlanner.java From herddb with Apache License 2.0 | 5 votes |
private PlannerOp planEnumerableUnion(EnumerableUnion op, RelDataType rowType, boolean returnValues) { if (!op.all) { throw new StatementExecutionException("not suppoer UNION, all=false"); } List<PlannerOp> inputs = new ArrayList<>(op.getInputs().size()); for (RelNode input : op.getInputs()) { PlannerOp inputOp = convertRelNode(input, rowType, false, false).optimize(); inputs.add(inputOp); } return new UnionAllOp(inputs); }
Example #3
Source File: VolcanoPlannerTest.java From calcite with Apache License 2.0 | 5 votes |
ThreeInputsUnionRule() { super( operand(EnumerableUnion.class, some( operand(PhysBiRel.class, any()), operand(PhysBiRel.class, any()), operand(PhysLeafRel.class, any())))); }