public static JoinPredicateInfo constructJoinPredicateInfo(Join j, RexNode predicate) throws CalciteSemanticException { return constructJoinPredicateInfo(j.getInputs(), j.getSystemFieldList(), predicate); }
public static JoinPredicateInfo constructJoinPredicateInfo(Join j, RexNode predicate) throws CalciteSemanticException { return constructJoinPredicateInfo(j.getInputs(), j.getSystemFieldList(), predicate); }
int nSysFields = joinRel.getSystemFieldList().size(); ImmutableBitSet rightFieldsBitSet = ImmutableBitSet.range(nSysFields + nFieldsLeft, nSysFields + nFieldsLeft + nFieldsRight);
int nSysFields = joinRel.getSystemFieldList().size(); ImmutableBitSet rightFieldsBitSet = ImmutableBitSet.range(nSysFields + nFieldsLeft, nSysFields + nFieldsLeft + nFieldsRight);
nFieldsLeft = joinRel.getLeft().getRowType().getFieldList().size(); nFieldsRight = joinRel.getRight().getRowType().getFieldList().size(); nSysFields = joinRel.getSystemFieldList().size(); leftFieldsBitSet = ImmutableBitSet.range(nSysFields, nSysFields + nFieldsLeft);
int nSysFields = join.getSystemFieldList().size(); ImmutableBitSet rightFieldsBitSet = ImmutableBitSet.range(nSysFields + nFieldsLeft, nSysFields + nFieldsLeft + nFieldsRight);
nFieldsLeft = joinRel.getLeft().getRowType().getFieldList().size(); nFieldsRight = joinRel.getRight().getRowType().getFieldList().size(); nSysFields = joinRel.getSystemFieldList().size(); leftFieldsBitSet = ImmutableBitSet.range(nSysFields, nSysFields + nFieldsLeft);
List<RelDataTypeField> projJoinFieldList = new ArrayList<>(); projJoinFieldList.addAll( join.getSystemFieldList()); projJoinFieldList.addAll( leftProjRel.getRowType().getFieldList());
@Override public RelWriter explainTerms(RelWriter pw) { return super.explainTerms(pw) .item("condition", condition) .item("joinType", joinType.lowerName) .itemIf( "systemFields", getSystemFieldList(), !getSystemFieldList().isEmpty()); }
@Override public RelWriter explainTerms(RelWriter pw) { return super.explainTerms(pw) .item("condition", condition) .item("joinType", joinType.lowerName) .itemIf( "systemFields", getSystemFieldList(), !getSystemFieldList().isEmpty()); }
public static JoinPredicateInfo constructJoinPredicateInfo(Join j, RexNode predicate) { return constructJoinPredicateInfo(j.getInputs(), j.getSystemFieldList(), predicate); }
@Override protected RelDataType deriveRowType() { return SqlValidatorUtil.deriveJoinRowType(left.getRowType(), right.getRowType(), joinType, getCluster().getTypeFactory(), null, getSystemFieldList()); }
@Override protected RelDataType deriveRowType() { return SqlValidatorUtil.deriveJoinRowType(left.getRowType(), right.getRowType(), joinType, getCluster().getTypeFactory(), null, getSystemFieldList()); }
public void onMatch(RelOptRuleCall call) { final Delta delta = call.rel(0); Util.discard(delta); final Join join = call.rel(1); final RelNode left = join.getLeft(); final RelNode right = join.getRight(); final LogicalDelta rightWithDelta = LogicalDelta.create(right); final LogicalJoin joinL = LogicalJoin.create(left, rightWithDelta, join.getCondition(), join.getVariablesSet(), join.getJoinType(), join.isSemiJoinDone(), ImmutableList.copyOf(join.getSystemFieldList())); final LogicalDelta leftWithDelta = LogicalDelta.create(left); final LogicalJoin joinR = LogicalJoin.create(leftWithDelta, right, join.getCondition(), join.getVariablesSet(), join.getJoinType(), join.isSemiJoinDone(), ImmutableList.copyOf(join.getSystemFieldList())); List<RelNode> inputsToUnion = new ArrayList<>(); inputsToUnion.add(joinL); inputsToUnion.add(joinR); final LogicalUnion newNode = LogicalUnion.create(inputsToUnion, true); call.transformTo(newNode); } }
public void onMatch(RelOptRuleCall call) { final Delta delta = call.rel(0); Util.discard(delta); final Join join = call.rel(1); final RelNode left = join.getLeft(); final RelNode right = join.getRight(); final LogicalDelta rightWithDelta = LogicalDelta.create(right); final LogicalJoin joinL = LogicalJoin.create(left, rightWithDelta, join.getCondition(), join.getVariablesSet(), join.getJoinType(), join.isSemiJoinDone(), ImmutableList.copyOf(join.getSystemFieldList())); final LogicalDelta leftWithDelta = LogicalDelta.create(left); final LogicalJoin joinR = LogicalJoin.create(leftWithDelta, right, join.getCondition(), join.getVariablesSet(), join.getJoinType(), join.isSemiJoinDone(), ImmutableList.copyOf(join.getSystemFieldList())); List<RelNode> inputsToUnion = new ArrayList<>(); inputsToUnion.add(joinL); inputsToUnion.add(joinR); final LogicalUnion newNode = LogicalUnion.create(inputsToUnion, true); call.transformTo(newNode); } }
public void onMatch(final RelOptRuleCall call) { Join join = call.rel(0); if (!join.getSystemFieldList().isEmpty()) { // FIXME Enable this rule for joins with system fields return; } final RelNode swapped = swap(join, this.swapOuter, call.builder()); if (swapped == null) { return; } // The result is either a Project or, if the project is trivial, a // raw Join. final Join newJoin = swapped instanceof Join ? (Join) swapped : (Join) swapped.getInput(0); call.transformTo(swapped); // We have converted join='a join b' into swapped='select // a0,a1,a2,b0,b1 from b join a'. Now register that project='select // b0,b1,a0,a1,a2 from (select a0,a1,a2,b0,b1 from b join a)' is the // same as 'b join a'. If we didn't do this, the swap join rule // would fire on the new join, ad infinitum. final RelBuilder relBuilder = call.builder(); final List<RexNode> exps = RelOptUtil.createSwappedJoinExprs(newJoin, join, false); relBuilder.push(swapped) .project(exps, newJoin.getRowType().getFieldNames()); call.getPlanner().ensureRegistered(relBuilder.build(), newJoin); }
public void onMatch(final RelOptRuleCall call) { Join join = call.rel(0); if (!join.getSystemFieldList().isEmpty()) { // FIXME Enable this rule for joins with system fields return; } final RelNode swapped = swap(join, this.swapOuter, call.builder()); if (swapped == null) { return; } // The result is either a Project or, if the project is trivial, a // raw Join. final Join newJoin = swapped instanceof Join ? (Join) swapped : (Join) swapped.getInput(0); call.transformTo(swapped); // We have converted join='a join b' into swapped='select // a0,a1,a2,b0,b1 from b join a'. Now register that project='select // b0,b1,a0,a1,a2 from (select a0,a1,a2,b0,b1 from b join a)' is the // same as 'b join a'. If we didn't do this, the swap join rule // would fire on the new join, ad infinitum. final RelBuilder relBuilder = call.builder(); final List<RexNode> exps = RelOptUtil.createSwappedJoinExprs(newJoin, join, false); relBuilder.push(swapped) .project(exps, newJoin.getRowType().getFieldNames()); call.getPlanner().ensureRegistered(relBuilder.build(), newJoin); }
if (!join.getSystemFieldList().isEmpty()) {
if (!join.getSystemFieldList().isEmpty()) {
!= getSystemFieldList().size() + left.getRowType().getFieldCount() + (this instanceof SemiJoin ? 0 : right.getRowType().getFieldCount())) { new RexChecker( getCluster().getTypeFactory().builder() .addAll(getSystemFieldList()) .addAll(getLeft().getRowType().getFieldList()) .addAll(getRight().getRowType().getFieldList())