Examples of LimitNode


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

    private PlanBuilder limit(PlanBuilder subPlan, List<SortItem> orderBy, Optional<String> limit)
    {
        if (orderBy.isEmpty() && limit.isPresent()) {
            long limitValue = Long.valueOf(limit.get());
            return new PlanBuilder(subPlan.getTranslations(), new LimitNode(idAllocator.getNextId(), subPlan.getRoot(), limitValue));
        }

        return subPlan;
    }
View Full Code Here

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

    @Test
    public void testLimit()
            throws Exception
    {
        PlanNode node = new LimitNode(newId(),
                filter(baseTableScan,
                        and(
                                equals(AE, BE),
                                equals(BE, CE),
                                lessThan(CE, number(10)))),
View Full Code Here

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

    @Test
    public void testLimit()
            throws Exception
    {
        PlanNode node = new LimitNode(newId(),
                filter(baseTableScan,
                        and(
                                equals(AE, BE),
                                equals(BE, CE),
                                lessThan(CE, number(10)))),
View Full Code Here

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

        {
            if (context != null && context.getExpression() instanceof LongLiteral && context.getWindowNode().isPresent()) {
                PlanNode rewrittenNode = planRewriter.rewrite(node, null);
                WindowNode windowNode = context.getWindowNode().get();
                if (windowNode.getOrderBy().isEmpty()) {
                    return new LimitNode(idAllocator.getNextId(), rewrittenNode, ((LongLiteral) context.getExpression()).getValue());
                }
                return new TopNNode(
                        idAllocator.getNextId(),
                        rewrittenNode,
                        ((LongLiteral) context.getExpression()).getValue(),
View Full Code Here

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

        @Override
        public PlanNode rewriteLimit(LimitNode node, Void context, PlanRewriter<Void> planRewriter)
        {
            PlanNode source = planRewriter.rewrite(node.getSource(), context);
            return new LimitNode(node.getId(), source, node.getCount());
        }
View Full Code Here

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

        public PlanNode rewriteNode(PlanNode node, LimitContext context, PlanRewriter<LimitContext> planRewriter)
        {
            PlanNode rewrittenNode = planRewriter.defaultRewrite(node, null);
            if (context != null) {
                // Drop in a LimitNode b/c we cannot push our limit down any further
                rewrittenNode = new LimitNode(idAllocator.getNextId(), rewrittenNode, context.getCount());
            }
            return rewrittenNode;
        }
View Full Code Here

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

                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());
            }
            return rewrittenNode;
        }
View Full Code Here

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

                sources.add(planRewriter.rewrite(node.getSources().get(i), context));
            }

            PlanNode output = new UnionNode(node.getId(), sources, node.getSymbolMapping());
            if (context != null) {
                output = new LimitNode(idAllocator.getNextId(), output, context.getCount());
            }
            return output;
        }
View Full Code Here

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

        public PlanNode rewriteLimit(LimitNode node, Set<Symbol> expectedOutputs, PlanRewriter<Set<Symbol>> planRewriter)
        {
            ImmutableSet.Builder<Symbol> expectedInputs = ImmutableSet.<Symbol>builder()
                    .addAll(expectedOutputs);
            PlanNode source = planRewriter.rewrite(node.getSource(), expectedInputs.build());
            return new LimitNode(node.getId(), source, node.getCount());
        }
View Full Code Here

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

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

            current.setRoot(new LimitNode(node.getId(), current.getRoot(), node.getCount()));

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

                // create merge plan fragment
                PlanNode source = new ExchangeNode(idAllocator.getNextId(), current.getId(), current.getRoot().getOutputSymbols());
                LimitNode merge = new LimitNode(idAllocator.getNextId(), source, node.getCount());
                current = createSingleNodePlan(merge)
                        .addChild(current.build());
            }

            return current;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.