rightFrame.r, decorrelateExpr(rel.getCondition()), rel.getJoinType() );
final RelDataTypeFactory typeFactory = join.getCluster().getTypeFactory(); final RelNode left = join.getLeft(); final JoinRelType joinType = join.getJoinType();
if (!info.isEqui() && join.getJoinType() != JoinRelType.INNER) { newRel = new OLAPJoinRel(cluster, traitSet, left, right, // info.leftKeys, info.rightKeys, join.getVariablesSet(), join.getJoinType()); } catch (InvalidRelException e) {
public boolean matches(RelOptRuleCall call) { LogicalJoin join = call.rel(0); switch (join.getJoinType()) { case INNER: case LEFT: return true; case FULL: case RIGHT: return false; default: throw Util.unexpected(join.getJoinType()); } }
public boolean matches(RelOptRuleCall call) { LogicalJoin join = call.rel(0); switch (join.getJoinType()) { case INNER: case LEFT: return true; case FULL: case RIGHT: return false; default: throw Util.unexpected(join.getJoinType()); } }
private static boolean populate(List<RelNode> nodes, List<int[][]> tempLinks, RelNode rel) { if (nodes.isEmpty() && rel instanceof LogicalProject) { return populate(nodes, tempLinks, ((LogicalProject) rel).getInput()); } if (rel instanceof TableScan) { nodes.add(rel); return true; } if (rel instanceof LogicalJoin) { LogicalJoin join = (LogicalJoin) rel; if (join.getJoinType() != JoinRelType.INNER) { throw new RuntimeException("only inner join allowed, but got " + join.getJoinType()); } populate(nodes, tempLinks, join.getLeft()); populate(nodes, tempLinks, join.getRight()); for (RexNode rex : RelOptUtil.conjunctions(join.getCondition())) { tempLinks.add(grab(nodes, rex)); } return true; } throw new RuntimeException("Invalid node type " + rel.getClass().getSimpleName() + " in lattice query"); }
private static boolean populate(List<RelNode> nodes, List<int[][]> tempLinks, RelNode rel) { if (nodes.isEmpty() && rel instanceof LogicalProject) { return populate(nodes, tempLinks, ((LogicalProject) rel).getInput()); } if (rel instanceof TableScan) { nodes.add(rel); return true; } if (rel instanceof LogicalJoin) { LogicalJoin join = (LogicalJoin) rel; if (join.getJoinType() != JoinRelType.INNER) { throw new RuntimeException("only inner join allowed, but got " + join.getJoinType()); } populate(nodes, tempLinks, join.getLeft()); populate(nodes, tempLinks, join.getRight()); for (RexNode rex : RelOptUtil.conjunctions(join.getCondition())) { tempLinks.add(grab(nodes, rex)); } return true; } throw new RuntimeException("Invalid node type " + rel.getClass().getSimpleName() + " in lattice query"); }
String remoteTableName = tableNode.getSourceName(); StreamTableJoinFunction joinFn = new SamzaSqlRemoteTableJoinFunction(context.getMsgConverter(remoteTableName), context.getTableKeyConverter(remoteTableName), streamNode, tableNode, join.getJoinType(), queryId); StreamTableJoinFunction joinFn = new SamzaSqlLocalTableJoinFunction(streamNode, tableNode, join.getJoinType());
@Override public RelNode visit(LogicalJoin join) { // to the best of my knowledge join.systemFieldList is always empty Preconditions.checkState(join.getSystemFieldList().isEmpty(), "join.systemFieldList is not empty!"); final RelNode left = join.getLeft().accept(this); final RelNode right = join.getRight().accept(this); return new LogicalJoin( cluster, copyOf(join.getTraitSet()), left, right, copyOf(join.getCondition()), join.getVariablesSet(), join.getJoinType(), join.isSemiJoinDone(), ImmutableList.<RelDataTypeField>of() ); }
@Override public RelNode visit(LogicalJoin join) { final RexNode conditionExpr = join.getCondition().accept(unwrappingExpressionVisitor); join = join.copy(join.getTraitSet(), conditionExpr, join.getLeft(), join.getRight(), join.getJoinType(), join.isSemiJoinDone()); return visitChildren(join); }
@Override public RelNode visit(LogicalJoin join) { final RexNode conditionExpr = join.getCondition().accept(unwrappingExpressionVisitor); join = join.copy(join.getTraitSet(), conditionExpr, join.getLeft(), join.getRight(), join.getJoinType(), join.isSemiJoinDone()); return visitChildren(join); }
public void rewriteRel(LogicalJoin rel) { LogicalJoin newRel = LogicalJoin.create(getNewForOldRel(rel.getLeft()), getNewForOldRel(rel.getRight()), rel.getCondition().accept(new RewriteRexShuttle()), rel.getVariablesSet(), rel.getJoinType()); setNewForOldRel(rel, newRel); }
public void rewriteRel(LogicalJoin rel) { LogicalJoin newRel = LogicalJoin.create(getNewForOldRel(rel.getLeft()), getNewForOldRel(rel.getRight()), rel.getCondition().accept(new RewriteRexShuttle()), rel.getVariablesSet(), rel.getJoinType()); setNewForOldRel(rel, newRel); }
if (!info.isEqui() && join.getJoinType() != JoinRelType.INNER) { newRel = new OLAPJoinRel(cluster, traitSet, left, right, // info.leftKeys, info.rightKeys, join.getVariablesSet(), join.getJoinType()); } catch (InvalidRelException e) {
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()); } }
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()); } }
private void validateJoinQuery(LogicalJoin join, JoinInputNode.InputType inputTypeOnLeft, JoinInputNode.InputType inputTypeOnRight) { JoinRelType joinRelType = join.getJoinType(); if (joinRelType.compareTo(JoinRelType.INNER) != 0 && joinRelType.compareTo(JoinRelType.LEFT) != 0 && joinRelType.compareTo(JoinRelType.RIGHT) != 0) { throw new SamzaException("Query with only INNER and LEFT/RIGHT OUTER join are supported."); } boolean isTablePosOnLeft = (inputTypeOnLeft != JoinInputNode.InputType.STREAM); boolean isTablePosOnRight = (inputTypeOnRight != JoinInputNode.InputType.STREAM); if (!isTablePosOnLeft && !isTablePosOnRight) { throw new SamzaException("Invalid query with both sides of join being denoted as 'stream'. " + "Stream-stream join is not yet supported. " + dumpRelPlanForNode(join)); } if (isTablePosOnLeft && isTablePosOnRight) { throw new SamzaException("Invalid query with both sides of join being denoted as 'table'. " + dumpRelPlanForNode(join)); } if (joinRelType.compareTo(JoinRelType.LEFT) == 0 && isTablePosOnLeft && !isTablePosOnRight) { throw new SamzaException("Invalid query for outer left join. Left side of the join should be a 'stream' and " + "right side of join should be a 'table'. " + dumpRelPlanForNode(join)); } if (joinRelType.compareTo(JoinRelType.RIGHT) == 0 && isTablePosOnRight && !isTablePosOnLeft) { throw new SamzaException("Invalid query for outer right join. Left side of the join should be a 'table' and " + "right side of join should be a 'stream'. " + dumpRelPlanForNode(join)); } validateJoinCondition(join.getCondition()); }
private void validateJoinQuery(LogicalJoin join) { JoinRelType joinRelType = join.getJoinType(); if (joinRelType.compareTo(JoinRelType.INNER) != 0 && joinRelType.compareTo(JoinRelType.LEFT) != 0 && joinRelType.compareTo(JoinRelType.RIGHT) != 0) { throw new SamzaException("Query with only INNER and LEFT/RIGHT OUTER join are supported."); } boolean isTablePosOnLeft = isTable(join.getLeft()); boolean isTablePosOnRight = isTable(join.getRight()); if (!isTablePosOnLeft && !isTablePosOnRight) { throw new SamzaException("Invalid query with both sides of join being denoted as 'stream'. " + "Stream-stream join is not yet supported. " + dumpRelPlanForNode(join)); } if (isTablePosOnLeft && isTablePosOnRight) { throw new SamzaException("Invalid query with both sides of join being denoted as 'table'. " + dumpRelPlanForNode(join)); } if (joinRelType.compareTo(JoinRelType.LEFT) == 0 && isTablePosOnLeft && !isTablePosOnRight) { throw new SamzaException("Invalid query for outer left join. Left side of the join should be a 'stream' and " + "right side of join should be a 'table'. " + dumpRelPlanForNode(join)); } if (joinRelType.compareTo(JoinRelType.RIGHT) == 0 && isTablePosOnRight && !isTablePosOnLeft) { throw new SamzaException("Invalid query for outer right join. Left side of the join should be a 'table' and " + "right side of join should be a 'stream'. " + dumpRelPlanForNode(join)); } validateJoinCondition(join.getCondition()); }
correlationId, requiredColumns.build(), SemiJoinType.of(join.getJoinType())); call.transformTo(newRel);
correlationId, requiredColumns.build(), SemiJoinType.of(join.getJoinType())); call.transformTo(newRel);