org.apache.calcite.adapter.enumerable.EnumerableHashJoin Java Examples
The following examples show how to use
org.apache.calcite.adapter.enumerable.EnumerableHashJoin.
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: CalcitePlanner.java From herddb with Apache License 2.0 | 6 votes |
private PlannerOp planEnumerableJoin(EnumerableHashJoin op, RelDataType rowType) { // please note that EnumerableJoin has a condition field which actually is not useful PlannerOp left = convertRelNode(op.getLeft(), null, false, false); PlannerOp right = convertRelNode(op.getRight(), null, false, false); final JoinInfo analyzeCondition = op.analyzeCondition(); int[] leftKeys = analyzeCondition.leftKeys.toIntArray(); int[] rightKeys = analyzeCondition.rightKeys.toIntArray(); boolean generateNullsOnLeft = op.getJoinType().generatesNullsOnLeft(); boolean generateNullsOnRight = op.getJoinType().generatesNullsOnRight(); List<CompiledSQLExpression> nonEquiConditions = convertJoinNonEquiConditions(analyzeCondition); final RelDataType _rowType = rowType == null ? op.getRowType() : rowType; List<RelDataTypeField> fieldList = _rowType.getFieldList(); Column[] columns = new Column[fieldList.size()]; String[] fieldNames = new String[columns.length]; int i = 0; for (RelDataTypeField field : fieldList) { Column col = Column.column(field.getName().toLowerCase(), convertToHerdType(field.getType())); fieldNames[i] = col.name; columns[i++] = col; } return new JoinOp(fieldNames, columns, leftKeys, left, rightKeys, right, generateNullsOnLeft, generateNullsOnRight, false, nonEquiConditions); }
Example #2
Source File: SqlHintsConverterTest.java From calcite with Apache License 2.0 | 6 votes |
@Override public RelNode convert(RelNode rel) { LogicalJoin join = (LogicalJoin) rel; assertThat(join.getHints().size(), is(1)); assertThat(join.getHints().get(0), is(expectedHint)); List<RelNode> newInputs = new ArrayList<>(); for (RelNode input : join.getInputs()) { if (!(input.getConvention() instanceof EnumerableConvention)) { input = convert( input, input.getTraitSet() .replace(EnumerableConvention.INSTANCE)); } newInputs.add(input); } final RelOptCluster cluster = join.getCluster(); final RelNode left = newInputs.get(0); final RelNode right = newInputs.get(1); final JoinInfo info = join.analyzeCondition(); return EnumerableHashJoin.create( left, right, info.getEquiCondition(left, right, cluster.getRexBuilder()), join.getVariablesSet(), join.getJoinType()); }
Example #3
Source File: CalcitePlanner.java From herddb with Apache License 2.0 | 5 votes |
private PlannerOp planEnumerableHashJoin(EnumerableHashJoin op, RelDataType rowType) { // please note that EnumerableSemiJoin has a condition field which actually is not useful PlannerOp left = convertRelNode(op.getLeft(), null, false, false); PlannerOp right = convertRelNode(op.getRight(), null, false, false); final JoinInfo analyzeCondition = op.analyzeCondition(); int[] leftKeys = analyzeCondition.leftKeys.toIntArray(); int[] rightKeys = analyzeCondition.rightKeys.toIntArray(); boolean generateNullsOnLeft = op.getJoinType().generatesNullsOnLeft(); boolean generateNullsOnRight = op.getJoinType().generatesNullsOnRight(); List<CompiledSQLExpression> nonEquiConditions = convertJoinNonEquiConditions(analyzeCondition); final RelDataType _rowType = rowType == null ? op.getRowType() : rowType; List<RelDataTypeField> fieldList = _rowType.getFieldList(); Column[] columns = new Column[fieldList.size()]; String[] fieldNames = new String[columns.length]; int i = 0; for (RelDataTypeField field : fieldList) { Column col = Column.column(field.getName().toLowerCase(), convertToHerdType(field.getType())); fieldNames[i] = col.name; columns[i++] = col; } return new JoinOp(fieldNames, columns, leftKeys, left, rightKeys, right, generateNullsOnLeft, generateNullsOnRight, false, nonEquiConditions); }
Example #4
Source File: FlinkRelMdCollation.java From flink with Apache License 2.0 | 4 votes |
public com.google.common.collect.ImmutableList<RelCollation> collations( EnumerableHashJoin join, RelMetadataQuery mq) { return com.google.common.collect.ImmutableList.copyOf( enumerableHashJoin(mq, join.getLeft(), join.getRight(), join.getJoinType())); }
Example #5
Source File: RelMdCollation.java From calcite with Apache License 2.0 | 4 votes |
public ImmutableList<RelCollation> collations(EnumerableHashJoin join, RelMetadataQuery mq) { return ImmutableList.copyOf( RelMdCollation.enumerableHashJoin(mq, join.getLeft(), join.getRight(), join.getJoinType())); }