Java Code Examples for org.apache.calcite.rel.logical.LogicalJoin#getCondition()
The following examples show how to use
org.apache.calcite.rel.logical.LogicalJoin#getCondition() .
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: ElasticsearchJoinRule.java From dk-fitting with Apache License 2.0 | 6 votes |
public RelNode convert(RelNode relNode) { LogicalJoin join = (LogicalJoin) relNode; List<RelNode> newInputs = new ArrayList<RelNode>(); for (RelNode input : join.getInputs()) { if (!(input.getConvention().getName().equals(ElasticsearchRelNode.CONVENTION.getName()))) { input = convert( input, input.getTraitSet() .replace(ElasticsearchRelNode.CONVENTION)); } newInputs.add(input); } final RelOptCluster cluster = join.getCluster(); final RelTraitSet traitSet = join.getTraitSet().replace(ElasticsearchRelNode.CONVENTION); final RelNode left = newInputs.get(0); final RelNode right = newInputs.get(1); return new ElasticsearchJoin(join.getCluster(), traitSet, left, right, join.getCondition(), join.getJoinType()); }
Example 2
Source File: ElasticsearchJoinRule.java From dk-fitting with Apache License 2.0 | 6 votes |
public RelNode convert(RelNode relNode) { LogicalJoin join = (LogicalJoin) relNode; List<RelNode> newInputs = new ArrayList<RelNode>(); for (RelNode input : join.getInputs()) { if (!(input.getConvention().getName().equals(ElasticsearchRelNode.CONVENTION.getName()))) { input = convert( input, input.getTraitSet() .replace(ElasticsearchRelNode.CONVENTION)); } newInputs.add(input); } final RelOptCluster cluster = join.getCluster(); final RelTraitSet traitSet = join.getTraitSet().replace(ElasticsearchRelNode.CONVENTION); final RelNode left = newInputs.get(0); final RelNode right = newInputs.get(1); return new ElasticsearchJoin(join.getCluster(), traitSet, left, right, join.getCondition(), join.getJoinType()); }
Example 3
Source File: RelOptUtil.java From Bats with Apache License 2.0 | 5 votes |
@Deprecated // to be removed before 2.0 public static boolean analyzeSimpleEquiJoin(LogicalJoin join, int[] joinFieldOrdinals) { RexNode joinExp = join.getCondition(); if (joinExp.getKind() != SqlKind.EQUALS) { return false; } RexCall binaryExpression = (RexCall) joinExp; RexNode leftComparand = binaryExpression.getOperands().get(0); RexNode rightComparand = binaryExpression.getOperands().get(1); if (!(leftComparand instanceof RexInputRef)) { return false; } if (!(rightComparand instanceof RexInputRef)) { return false; } final int leftFieldCount = join.getLeft().getRowType().getFieldCount(); RexInputRef leftFieldAccess = (RexInputRef) leftComparand; if (!(leftFieldAccess.getIndex() < leftFieldCount)) { // left field must access left side of join return false; } RexInputRef rightFieldAccess = (RexInputRef) rightComparand; if (!(rightFieldAccess.getIndex() >= leftFieldCount)) { // right field must access right side of join return false; } joinFieldOrdinals[0] = leftFieldAccess.getIndex(); joinFieldOrdinals[1] = rightFieldAccess.getIndex() - leftFieldCount; return true; }
Example 4
Source File: RelOptUtil.java From calcite with Apache License 2.0 | 5 votes |
@Deprecated // to be removed before 2.0 public static boolean analyzeSimpleEquiJoin( LogicalJoin join, int[] joinFieldOrdinals) { RexNode joinExp = join.getCondition(); if (joinExp.getKind() != SqlKind.EQUALS) { return false; } RexCall binaryExpression = (RexCall) joinExp; RexNode leftComparand = binaryExpression.operands.get(0); RexNode rightComparand = binaryExpression.operands.get(1); if (!(leftComparand instanceof RexInputRef)) { return false; } if (!(rightComparand instanceof RexInputRef)) { return false; } final int leftFieldCount = join.getLeft().getRowType().getFieldCount(); RexInputRef leftFieldAccess = (RexInputRef) leftComparand; if (!(leftFieldAccess.getIndex() < leftFieldCount)) { // left field must access left side of join return false; } RexInputRef rightFieldAccess = (RexInputRef) rightComparand; if (!(rightFieldAccess.getIndex() >= leftFieldCount)) { // right field must access right side of join return false; } joinFieldOrdinals[0] = leftFieldAccess.getIndex(); joinFieldOrdinals[1] = rightFieldAccess.getIndex() - leftFieldCount; return true; }
Example 5
Source File: Bindables.java From calcite with Apache License 2.0 | 5 votes |
public RelNode convert(RelNode rel) { final LogicalJoin join = (LogicalJoin) rel; final BindableConvention out = BindableConvention.INSTANCE; final RelTraitSet traitSet = join.getTraitSet().replace(out); return new BindableJoin(rel.getCluster(), traitSet, convert(join.getLeft(), join.getLeft().getTraitSet() .replace(BindableConvention.INSTANCE)), convert(join.getRight(), join.getRight().getTraitSet() .replace(BindableConvention.INSTANCE)), join.getCondition(), join.getVariablesSet(), join.getJoinType()); }
Example 6
Source File: PigRules.java From calcite with Apache License 2.0 | 4 votes |
public RelNode convert(RelNode rel) { final LogicalJoin join = (LogicalJoin) rel; final RelTraitSet traitSet = join.getTraitSet().replace(PigRel.CONVENTION); return new PigJoin(join.getCluster(), traitSet, join.getLeft(), join.getRight(), join.getCondition(), join.getJoinType()); }