Package com.facebook.presto.sql.planner.plan

Examples of com.facebook.presto.sql.planner.plan.DistinctLimitNode


        @Override
        public SubPlanBuilder visitDistinctLimit(DistinctLimitNode node, Void context)
        {
            SubPlanBuilder current = node.getSource().accept(this, context);

            current.setRoot(new DistinctLimitNode(node.getId(), current.getRoot(), node.getLimit()));

            if (current.isDistributed()) {
                current.setRoot(new SinkNode(idAllocator.getNextId(), current.getRoot(), current.getRoot().getOutputSymbols()));

                PlanNode source = new ExchangeNode(idAllocator.getNextId(), current.getId(), current.getRoot().getOutputSymbols());
                DistinctLimitNode merge = new DistinctLimitNode(idAllocator.getNextId(), source, node.getLimit());
                current = createSingleNodePlan(merge).addChild(current.build());
            }
            return current;
        }
View Full Code Here


        @Override
        public SubPlanBuilder visitDistinctLimit(DistinctLimitNode node, Void context)
        {
            SubPlanBuilder current = node.getSource().accept(this, context);

            current.setRoot(new DistinctLimitNode(node.getId(), current.getRoot(), node.getLimit()));

            if (current.isDistributed()) {
                current.setRoot(new SinkNode(idAllocator.getNextId(), current.getRoot(), current.getRoot().getOutputSymbols()));

                PlanNode source = new ExchangeNode(idAllocator.getNextId(), current.getId(), current.getRoot().getOutputSymbols());
                DistinctLimitNode merge = new DistinctLimitNode(idAllocator.getNextId(), source, node.getLimit());
                current = createSingleNodePlan(merge).addChild(current.build());
            }
            return current;
        }
View Full Code Here

        @Override
        public PlanNode rewriteDistinctLimit(DistinctLimitNode node, Set<Symbol> expectedOutputs, PlanRewriter<Set<Symbol>> planRewriter)
        {
            PlanNode source = planRewriter.rewrite(node.getSource(), ImmutableSet.copyOf(node.getOutputSymbols()));
            return new DistinctLimitNode(node.getId(), source, node.getLimit());
        }
View Full Code Here

        @Override
        public SubPlanBuilder visitDistinctLimit(DistinctLimitNode node, Void context)
        {
            SubPlanBuilder current = node.getSource().accept(this, context);

            current.setRoot(new DistinctLimitNode(node.getId(), current.getRoot(), node.getLimit()));

            if (current.isDistributed()) {
                current.setRoot(new SinkNode(idAllocator.getNextId(), current.getRoot(), current.getRoot().getOutputSymbols()));

                PlanNode source = new ExchangeNode(idAllocator.getNextId(), current.getId(), current.getRoot().getOutputSymbols());
                DistinctLimitNode merge = new DistinctLimitNode(idAllocator.getNextId(), source, node.getLimit());
                current = createSingleNodePlan(merge).addChild(current.build());
            }
            return current;
        }
View Full Code Here

                for (Symbol symbol : source.getOutputSymbols()) {
                    Expression expression = new QualifiedNameReference(symbol.toQualifiedName());
                    projections.put(symbol, expression);
                }
                source = new ProjectNode(idAllocator.getNextId(), ((MaterializeSampleNode) source).getSource(), projections.build());
                return new DistinctLimitNode(node.getId(), source, node.getLimit());
            }
            else {
                return new DistinctLimitNode(node.getId(), source, node.getLimit());
            }
        }
View Full Code Here

                    node.getOutputSymbols().size() == node.getGroupBy().size() &&
                    node.getOutputSymbols().containsAll(node.getGroupBy())) {
                checkArgument(!context.getSampleWeight().isPresent(), "sample weight symbol referenced after a DISTINCT node");
                checkArgument(!node.getSampleWeight().isPresent(), "DISTINCT aggregation has sample weight symbol");
                PlanNode rewrittenSource = planRewriter.rewrite(node.getSource(), null);
                return new DistinctLimitNode(idAllocator.getNextId(), rewrittenSource, context.getCount());
            }
            PlanNode rewrittenNode = planRewriter.defaultRewrite(node, null);
            if (context != null) {
                checkState(!context.getSampleWeight().isPresent(), "Aggregations do not output a sample weight, but limit consumes one");
                // Drop in a LimitNode b/c limits cannot be pushed through aggregations
View Full Code Here

        @Override
        public PlanNode rewriteDistinctLimit(DistinctLimitNode node, Set<Symbol> expectedOutputs, PlanRewriter<Set<Symbol>> planRewriter)
        {
            PlanNode source = planRewriter.rewrite(node.getSource(), ImmutableSet.copyOf(node.getOutputSymbols()));
            return new DistinctLimitNode(node.getId(), source, node.getLimit());
        }
View Full Code Here

        @Override
        public SubPlanBuilder visitDistinctLimit(DistinctLimitNode node, Void context)
        {
            SubPlanBuilder current = node.getSource().accept(this, context);

            current.setRoot(new DistinctLimitNode(node.getId(), current.getRoot(), node.getLimit()));

            if (current.isDistributed()) {
                current.setRoot(new SinkNode(idAllocator.getNextId(), current.getRoot(), current.getRoot().getOutputSymbols()));

                PlanNode source = new ExchangeNode(idAllocator.getNextId(), current.getId(), current.getRoot().getOutputSymbols());
                DistinctLimitNode merge = new DistinctLimitNode(idAllocator.getNextId(), source, node.getLimit());
                current = createSingleNodePlan(merge).addChild(current.build());
            }
            return current;
        }
View Full Code Here

                    node.getAggregations().isEmpty() &&
                    node.getOutputSymbols().size() == node.getGroupBy().size() &&
                    node.getOutputSymbols().containsAll(node.getGroupBy())) {
                checkArgument(!node.getSampleWeight().isPresent(), "DISTINCT aggregation has sample weight symbol");
                PlanNode rewrittenSource = planRewriter.rewrite(node.getSource(), null);
                return new DistinctLimitNode(idAllocator.getNextId(), rewrittenSource, context.getCount());
            }
            PlanNode rewrittenNode = planRewriter.defaultRewrite(node, null);
            if (context != null) {
                // Drop in a LimitNode b/c limits cannot be pushed through aggregations
                rewrittenNode = new LimitNode(idAllocator.getNextId(), rewrittenNode, context.getCount());
View Full Code Here

        @Override
        public PlanNode rewriteDistinctLimit(DistinctLimitNode node, Set<Symbol> expectedOutputs, PlanRewriter<Set<Symbol>> planRewriter)
        {
            PlanNode source = planRewriter.rewrite(node.getSource(), ImmutableSet.copyOf(node.getOutputSymbols()));
            return new DistinctLimitNode(node.getId(), source, node.getLimit());
        }
View Full Code Here

TOP

Related Classes of com.facebook.presto.sql.planner.plan.DistinctLimitNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.