@Override protected Optional<PlanNode> manipulateAdjacentWindowNodes(WindowNode parent, WindowNode child, Context context) { if ((compare(parent, child) < 0) && (!dependsOn(parent, child))) { PlanNode transposedWindows = transpose(parent, child); return Optional.of( restrictOutputs(context.getIdAllocator(), transposedWindows, ImmutableSet.copyOf(parent.getOutputSymbols())) .orElse(transposedWindows)); } else { return Optional.empty(); } }
print(indent, "- Window[%s]%s => [%s]", Joiner.on(", ").join(args), formatHash(node.getHashSymbol()), formatOutputs(node.getOutputSymbols())); printPlanNodesStatsAndCost(indent + 2, node); printStats(indent + 2, node.getId());
Set<Symbol> targetOutputs = ImmutableSet.copyOf(target.getOutputSymbols()); Set<Symbol> newTargetOutputs = ImmutableSet.copyOf(newTarget.getOutputSymbols()); if (!newTargetOutputs.containsAll(projects.get(projects.size() - 1).getOutputSymbols())) {
windowNode.getPreSortedOrderPrefix()); if (prunedWindowNode.getOutputSymbols().size() == windowNode.getOutputSymbols().size()) {
@Override protected Optional<PlanNode> manipulateAdjacentWindowNodes(WindowNode parent, WindowNode child, Context context) { if (!child.getSpecification().equals(parent.getSpecification()) || dependsOn(parent, child)) { return Optional.empty(); } ImmutableMap.Builder<Symbol, WindowNode.Function> functionsBuilder = ImmutableMap.builder(); functionsBuilder.putAll(parent.getWindowFunctions()); functionsBuilder.putAll(child.getWindowFunctions()); WindowNode mergedWindowNode = new WindowNode( parent.getId(), child.getSource(), parent.getSpecification(), functionsBuilder.build(), parent.getHashSymbol(), parent.getPrePartitionedInputs(), parent.getPreSortedOrderPrefix()); return Optional.of( restrictOutputs(context.getIdAllocator(), mergedWindowNode, ImmutableSet.copyOf(parent.getOutputSymbols())) .orElse(mergedWindowNode)); } }
print(indent, "- Window[%s] => [%s]", Joiner.on(", ").join(args), formatOutputs(node.getOutputSymbols()));