.build(); checkArgument(new HashSet<>(inputSymbols).containsAll(outputSymbols), "Left and right join inputs do not contain all output symbols"); checkArgument(!isCrossJoin() || inputSymbols.size() == outputSymbols.size(), "Cross join does not support output symbols pruning or reordering");
private List<JoinEnumerationResult> getPossibleJoinNodes(JoinNode joinNode, JoinDistributionType distributionType) { checkArgument(joinNode.getType() == INNER, "unexpected join node type: %s", joinNode.getType()); if (joinNode.isCrossJoin()) { return getPossibleJoinNodes(joinNode, REPLICATED); } switch (distributionType) { case PARTITIONED: return getPossibleJoinNodes(joinNode, PARTITIONED); case BROADCAST: return getPossibleJoinNodes(joinNode, REPLICATED); case AUTOMATIC: ImmutableList.Builder<JoinEnumerationResult> result = ImmutableList.builder(); result.addAll(getPossibleJoinNodes(joinNode, PARTITIONED)); if (canReplicate(joinNode, context)) { result.addAll(getPossibleJoinNodes(joinNode, REPLICATED)); } return result.build(); default: throw new IllegalArgumentException("unexpected join distribution type: " + distributionType); } }
if (node.isCrossJoin()) {
@Override public PhysicalOperation visitJoin(JoinNode node, LocalExecutionPlanContext context) { if (node.isCrossJoin()) { return createNestedLoopJoin(node, context); } List<JoinNode.EquiJoinClause> clauses = node.getCriteria(); List<Symbol> leftSymbols = Lists.transform(clauses, JoinNode.EquiJoinClause::getLeft); List<Symbol> rightSymbols = Lists.transform(clauses, JoinNode.EquiJoinClause::getRight); switch (node.getType()) { case INNER: case LEFT: case RIGHT: case FULL: return createLookupJoin(node, node.getLeft(), leftSymbols, node.getLeftHashSymbol(), node.getRight(), rightSymbols, node.getRightHashSymbol(), context); default: throw new UnsupportedOperationException("Unsupported join type: " + node.getType()); } }
@Override public Void visitJoin(JoinNode node, Integer indent) { List<Expression> joinExpressions = new ArrayList<>(); for (JoinNode.EquiJoinClause clause : node.getCriteria()) { joinExpressions.add(clause.toExpression()); } node.getFilter().ifPresent(joinExpressions::add); if (node.isCrossJoin()) { checkState(joinExpressions.isEmpty()); print(indent, "- CrossJoin => [%s]", formatOutputs(node.getOutputSymbols())); } else { print(indent, "- %s[%s]%s => [%s]", node.getType().getJoinLabel(), Joiner.on(" AND ").join(joinExpressions), formatHash(node.getLeftHashSymbol(), node.getRightHashSymbol()), formatOutputs(node.getOutputSymbols())); } node.getDistributionType().ifPresent(distributionType -> print(indent + 2, "Distribution: %s", distributionType)); node.getSortExpressionContext().ifPresent(context -> print(indent + 2, "SortExpression[%s]", context.getSortExpression())); printPlanNodesStatsAndCost(indent + 2, node); printStats(indent + 2, node.getId()); node.getLeft().accept(this, indent + 1); node.getRight().accept(this, indent + 1); return null; }
@Override public Void visitJoin(JoinNode node, Integer indent) { JoinNode.DistributionType distributionType = node.getDistributionType() .orElseThrow(() -> new VerifyException("Expected distribution type to be set")); if (node.isCrossJoin()) { checkState(node.getType() == INNER && distributionType == REPLICATED, "Expected CROSS JOIN to be INNER REPLICATED"); output(indent, "cross join:"); } else { output(indent, "join (%s, %s):", node.getType(), distributionType); } return visitPlan(node, indent + 1); }
constants.putAll(buildProperties.getConstants()); if (node.isCrossJoin()) {