@Override public Expression visitDistinctLimit(DistinctLimitNode node, Void context) { return node.getSource().accept(this, context); }
@Override public Map<PlanNodeId, SplitSource> visitDistinctLimit(DistinctLimitNode node, Void context) { return node.getSource().accept(this, context); }
@Override public Void visitDistinctLimit(DistinctLimitNode node, Void context) { printNode(node, format("DistinctLimit[%s]", node.getLimit()), NODE_COLORS.get(NodeType.LIMIT)); return node.getSource().accept(this, context); }
@Override public PlanNode visitDistinctLimit(DistinctLimitNode node, RewriteContext<Set<Symbol>> context) { Set<Symbol> expectedInputs; if (node.getHashSymbol().isPresent()) { expectedInputs = ImmutableSet.copyOf(concat(node.getDistinctSymbols(), ImmutableList.of(node.getHashSymbol().get()))); } else { expectedInputs = ImmutableSet.copyOf(node.getDistinctSymbols()); } PlanNode source = context.rewrite(node.getSource(), expectedInputs); return new DistinctLimitNode(node.getId(), source, node.getLimit(), node.isPartial(), node.getDistinctSymbols(), node.getHashSymbol()); }
@Override public Void visitDistinctLimit(DistinctLimitNode node, Set<Symbol> boundSymbols) { PlanNode source = node.getSource(); source.accept(this, boundSymbols); // visit child checkDependencies(source.getOutputSymbols(), node.getOutputSymbols(), "Invalid node. Output column dependencies (%s) not in source plan output (%s)", node.getOutputSymbols(), source.getOutputSymbols()); return null; }
@Override public PhysicalOperation visitDistinctLimit(DistinctLimitNode node, LocalExecutionPlanContext context) { PhysicalOperation source = node.getSource().accept(this, context); Optional<Integer> hashChannel = node.getHashSymbol().map(channelGetter(source)); List<Integer> distinctChannels = getChannelsForSymbols(node.getDistinctSymbols(), source.getLayout()); OperatorFactory operatorFactory = new DistinctLimitOperatorFactory( context.getNextOperatorId(), node.getId(), source.getTypes(), distinctChannels, node.getLimit(), hashChannel, joinCompiler); return new PhysicalOperation(operatorFactory, makeLayout(node), context, source); }
@Override public PlanWithProperties visitDistinctLimit(DistinctLimitNode node, HashComputationSet parentPreference) { // skip hash symbol generation for single bigint if (canSkipHashGeneration(node.getDistinctSymbols())) { return planSimpleNodeWithProperties(node, parentPreference); } Optional<HashComputation> hashComputation = computeHash(node.getDistinctSymbols()); PlanWithProperties child = planAndEnforce( node.getSource(), new HashComputationSet(hashComputation), false, parentPreference.withHashComputation(node, hashComputation)); Symbol hashSymbol = child.getRequiredHashSymbol(hashComputation.get()); // TODO: we need to reason about how pre-computed hashes from child relate to distinct symbols. We should be able to include any precomputed hash // that's functionally dependent on the distinct field in the set of distinct fields of the new node to be able to propagate it downstream. // Currently, such precomputed hashes will be dropped by this operation. return new PlanWithProperties( new DistinctLimitNode(node.getId(), child.getNode(), node.getLimit(), node.isPartial(), node.getDistinctSymbols(), Optional.of(hashSymbol)), ImmutableMap.of(hashComputation.get(), hashSymbol)); }
@Override public PlanNode visitDistinctLimit(DistinctLimitNode node, RewriteContext<Void> context) { return new DistinctLimitNode(node.getId(), context.rewrite(node.getSource()), node.getLimit(), node.isPartial(), canonicalizeAndDistinct(node.getDistinctSymbols()), canonicalize(node.getHashSymbol())); }
@Override public Optional<SplitSource> visitDistinctLimit(DistinctLimitNode node, Void context) { return node.getSource().accept(this, context); }
@Override public Expression visitDistinctLimit(DistinctLimitNode node, Void context) { return node.getSource().accept(this, context); }
@Override public Void visitDistinctLimit(DistinctLimitNode node, Void context) { node.getSource().accept(this, context); return null; }
@Override public Void visitDistinctLimit(DistinctLimitNode node, Void context) { PlanNode source = node.getSource(); source.accept(this, context); // visit child verifyUniqueId(node); return null; }
@Override public Void visitDistinctLimit(DistinctLimitNode node, Void context) { printNode(node, format("DistinctLimit[%s]", node.getLimit()), NODE_COLORS.get(NodeType.LIMIT)); return node.getSource().accept(this, context); }
@Override public PlanNode visitDistinctLimit(DistinctLimitNode node, RewriteContext<Set<Symbol>> context) { Set<Symbol> expectedInputs; if (node.getHashSymbol().isPresent()) { expectedInputs = ImmutableSet.copyOf(concat(node.getOutputSymbols(), ImmutableList.of(node.getHashSymbol().get()))); } else { expectedInputs = ImmutableSet.copyOf(node.getOutputSymbols()); } PlanNode source = context.rewrite(node.getSource(), expectedInputs); return new DistinctLimitNode(node.getId(), source, node.getLimit(), node.getHashSymbol()); }
@Override public PlanNode visitDistinctLimit(DistinctLimitNode node, RewriteContext<Void> context) { PlanNode rewrittenSource = context.rewrite(node.getSource(), null); Symbol hashSymbol = symbolAllocator.newHashSymbol(); PlanNode hashProjectNode = getHashProjectNode(idAllocator, rewrittenSource, hashSymbol, node.getOutputSymbols()); return new DistinctLimitNode(idAllocator.getNextId(), hashProjectNode, node.getLimit(), Optional.of(hashSymbol)); }
@Override public PlanNode visitDistinctLimit(DistinctLimitNode node, RewriteContext<Void> context) { return new DistinctLimitNode(node.getId(), context.rewrite(node.getSource()), node.getLimit(), canonicalize(node.getHashSymbol())); }
@Override public PhysicalOperation visitDistinctLimit(DistinctLimitNode node, LocalExecutionPlanContext context) { PhysicalOperation source = node.getSource().accept(this, context); Optional<Integer> hashChannel = node.getHashSymbol().map(channelGetter(source)); List<Integer> distinctChannels = getChannelsForSymbols(node.getDistinctSymbols(), source.getLayout()); OperatorFactory operatorFactory = new DistinctLimitOperatorFactory( context.getNextOperatorId(), node.getId(), source.getTypes(), distinctChannels, node.getLimit(), hashChannel); return new PhysicalOperation(operatorFactory, source.getLayout(), source); }