Examples of TopNOperatorFactory


Examples of com.facebook.presto.operator.TopNOperator.TopNOperatorFactory

                .row(4, 0.41)
                .row(6, 0.6)
                .pageBreak()
                .build();

        TopNOperatorFactory factory = new TopNOperatorFactory(
                0,
                2,
                ImmutableList.of(singleColumn(FIXED_INT_64, 0), singleColumn(DOUBLE, 1)),
                Ordering.from(new FieldOrderedTupleComparator(ImmutableList.of(0), ImmutableList.of(SortOrder.DESC_NULLS_LAST))),
                Optional.<Integer>absent(),
                false);

        Operator operator = factory.createOperator(driverContext);

        MaterializedResult expected = resultBuilder(FIXED_INT_64, DOUBLE)
                .row(6, 0.6)
                .row(5, 0.5)
                .build();
View Full Code Here

Examples of com.facebook.presto.operator.TopNOperator.TopNOperatorFactory

                .row("d", 7)
                .row("e", 6)
                .build();

        FieldOrderedTupleComparator comparator = new FieldOrderedTupleComparator(ImmutableList.of(0, 1), ImmutableList.of(SortOrder.DESC_NULLS_LAST, SortOrder.DESC_NULLS_LAST));
        TopNOperatorFactory operatorFactory = new TopNOperatorFactory(
                0,
                3,
                ImmutableList.of(singleColumn(VARIABLE_BINARY, 0), singleColumn(FIXED_INT_64, 1)),
                Ordering.from(comparator),
                Optional.<Integer>absent(),
                false);

        Operator operator = operatorFactory.createOperator(driverContext);

        MaterializedResult expected = MaterializedResult.resultBuilder(VARIABLE_BINARY, FIXED_INT_64)
                .row("f", 3)
                .row("e", 6)
                .row("d", 7)
View Full Code Here

Examples of com.facebook.presto.operator.TopNOperator.TopNOperatorFactory

                .row(4, 0.41)
                .row(6, 0.6)
                .pageBreak()
                .build();

        TopNOperatorFactory operatorFactory = new TopNOperatorFactory(
                0,
                2,
                ImmutableList.of(singleColumn(FIXED_INT_64, 0), singleColumn(DOUBLE, 1)),
                Ordering.from(new FieldOrderedTupleComparator(ImmutableList.of(0), ImmutableList.of(SortOrder.ASC_NULLS_LAST))),
                Optional.<Integer>absent(),
                false);

        Operator operator = operatorFactory.createOperator(driverContext);

        MaterializedResult expected = resultBuilder(FIXED_INT_64, DOUBLE)
                .row(-1, -0.1)
                .row(1, 0.1)
                .build();
View Full Code Here

Examples of com.facebook.presto.operator.TopNOperator.TopNOperatorFactory

                .row(5, 0.5)
                .pageBreak()
                .build();
        input = appendSampleWeight(input, 2);

        TopNOperatorFactory factory = new TopNOperatorFactory(
                0,
                ImmutableList.of(BIGINT, DOUBLE, BIGINT),
                5,
                ImmutableList.of(0),
                ImmutableList.of(DESC_NULLS_LAST),
                Optional.of(input.get(0).getChannelCount() - 1),
                false);

        Operator operator = factory.createOperator(driverContext);

        MaterializedResult expected = resultBuilder(driverContext.getSession(), BIGINT, DOUBLE, BIGINT)
                .row(6, 0.6, 2)
                .row(5, 0.5, 1)
                .row(5, 0.5, 2)
View Full Code Here

Examples of com.facebook.presto.operator.TopNOperator.TopNOperatorFactory

                .row(4, 0.41)
                .row(6, 0.6)
                .pageBreak()
                .build();

        TopNOperatorFactory factory = new TopNOperatorFactory(
                0,
                ImmutableList.of(BIGINT, DOUBLE),
                2,
                ImmutableList.of(0),
                ImmutableList.of(DESC_NULLS_LAST),
                Optional.<Integer>absent(),
                false);

        Operator operator = factory.createOperator(driverContext);

        MaterializedResult expected = resultBuilder(driverContext.getSession(), BIGINT, DOUBLE)
                .row(6, 0.6)
                .row(5, 0.5)
                .build();
View Full Code Here

Examples of com.facebook.presto.operator.TopNOperator.TopNOperatorFactory

                .row("d", 5)
                .row("d", 7)
                .row("e", 6)
                .build();

        TopNOperatorFactory operatorFactory = new TopNOperatorFactory(
                0,
                ImmutableList.of(VARCHAR, BIGINT),
                3,
                ImmutableList.of(0, 1),
                ImmutableList.of(DESC_NULLS_LAST, DESC_NULLS_LAST),
                Optional.<Integer>absent(),
                false);

        Operator operator = operatorFactory.createOperator(driverContext);

        MaterializedResult expected = MaterializedResult.resultBuilder(driverContext.getSession(), VARCHAR, BIGINT)
                .row("f", 3)
                .row("e", 6)
                .row("d", 7)
View Full Code Here

Examples of com.facebook.presto.operator.TopNOperator.TopNOperatorFactory

                .row(4, 0.41)
                .row(6, 0.6)
                .pageBreak()
                .build();

        TopNOperatorFactory operatorFactory = new TopNOperatorFactory(
                0,
                ImmutableList.of(BIGINT, DOUBLE),
                2,
                ImmutableList.of(0),
                ImmutableList.of(ASC_NULLS_LAST),
                Optional.<Integer>absent(),
                false);

        Operator operator = operatorFactory.createOperator(driverContext);

        MaterializedResult expected = resultBuilder(driverContext.getSession(), BIGINT, DOUBLE)
                .row(-1, -0.1)
                .row(1, 0.1)
                .build();
View Full Code Here

Examples of com.facebook.presto.operator.TopNOperator.TopNOperatorFactory

    @Override
    protected List<? extends OperatorFactory> createOperatorFactories()
    {
        OperatorFactory tableScanOperator = createTableScanOperator(0, "orders", "totalprice");
        TopNOperatorFactory topNOperator = new TopNOperatorFactory(
                1,
                tableScanOperator.getTypes(),
                100,
                ImmutableList.of(0),
                ImmutableList.of(ASC_NULLS_LAST),
View Full Code Here

Examples of com.facebook.presto.operator.TopNOperator.TopNOperatorFactory

                sortOrders.add(node.getOrderings().get(symbol));
            }

            Optional<Integer> sampleWeightChannel = node.getSampleWeight().transform(source.channelGetter());

            OperatorFactory operator = new TopNOperatorFactory(
                    context.getNextOperatorId(),
                    source.getTypes(),
                    (int) node.getCount(),
                    sortChannels,
                    sortOrders,
View Full Code Here

Examples of com.facebook.presto.operator.TopNOperator.TopNOperatorFactory

            for (Symbol symbol : orderBySymbols) {
                sortChannels.add(source.getLayout().get(symbol));
                sortOrders.add(node.getOrderings().get(symbol));
            }

            OperatorFactory operator = new TopNOperatorFactory(
                    context.getNextOperatorId(),
                    source.getTypes(),
                    (int) node.getCount(),
                    sortChannels,
                    sortOrders,
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.