Package com.facebook.presto.operator.FilterAndProjectOperator

Examples of com.facebook.presto.operator.FilterAndProjectOperator.FilterAndProjectOperatorFactory


    @Override
    protected List<? extends OperatorFactory> createOperatorFactories()
    {
        OperatorFactory tableScanOperator = createTableScanOperator(0, "orders", "totalprice");
        FilterAndProjectOperatorFactory filterAndProjectOperator = new FilterAndProjectOperatorFactory(
                1,
                new DoubleFilter(50000.00),
                ImmutableList.of(singleColumn(DOUBLE, 0)));

        return ImmutableList.of(tableScanOperator, filterAndProjectOperator);
View Full Code Here


    {
        List<Page> input = rowPagesBuilder(VARCHAR, BIGINT)
                .addSequencePage(100, 0, 0)
                .build();

        OperatorFactory operatorFactory = new FilterAndProjectOperatorFactory(
                0,
                new FilterFunction()
                {
                    @Override
                    public boolean filter(BlockCursor... cursors)
                    {
                        long value = cursors[1].getLong();
                        return 10 <= value && value < 20;
                    }

                    @Override
                    public boolean filter(RecordCursor cursor)
                    {
                        long value = cursor.getLong(0);
                        return 10 <= value && value < 20;
                    }
                },
                ImmutableList.of(singleColumn(VARCHAR, 0), new Add5Projection(1)));

        Operator operator = operatorFactory.createOperator(driverContext);

        MaterializedResult expected = MaterializedResult.resultBuilder(driverContext.getSession(), VARCHAR, BIGINT)
                .row("10", 15)
                .row("11", 16)
                .row("12", 17)
View Full Code Here

    @Override
    protected List<? extends OperatorFactory> createOperatorFactories()
    {
        OperatorFactory tableScanOperator = createTableScanOperator(0, "orders", "totalprice");
        FilterAndProjectOperatorFactory filterAndProjectOperator = new FilterAndProjectOperatorFactory(
                1,
                new DoubleFilter(50000.00),
                ImmutableList.of(singleColumn(DOUBLE, 0)));

        return ImmutableList.of(tableScanOperator, filterAndProjectOperator);
View Full Code Here

                INPUT_MAPPING,
                metadata,
                session
        );

        OperatorFactory operatorFactory = new FilterAndProjectOperatorFactory(0, filterFunction, ImmutableList.of(projectionFunction));
        return operatorFactory.createOperator(createDriverContext(session));
    }
View Full Code Here

    {
        List<Page> input = rowPagesBuilder(VARCHAR, BIGINT)
                .addSequencePage(100, 0, 0)
                .build();

        OperatorFactory operatorFactory = new FilterAndProjectOperatorFactory(
                0,
                new FilterFunction()
                {
                    @Override
                    public boolean filter(BlockCursor... cursors)
                    {
                        long value = cursors[1].getLong();
                        return 10 <= value && value < 20;
                    }

                    @Override
                    public boolean filter(RecordCursor cursor)
                    {
                        long value = cursor.getLong(0);
                        return 10 <= value && value < 20;
                    }
                },
                ImmutableList.of(singleColumn(VARCHAR, 0), new Add5Projection(1)));

        Operator operator = operatorFactory.createOperator(driverContext);

        MaterializedResult expected = MaterializedResult.resultBuilder(driverContext.getSession(), VARCHAR, BIGINT)
                .row("10", 15)
                .row("11", 16)
                .row("12", 17)
View Full Code Here

            }

            // otherwise, introduce a projection to match the expected output
            IdentityProjectionInfo mappings = computeIdentityMapping(resultSymbols, source.getLayout(), context.getTypes());

            OperatorFactory operatorFactory = new FilterAndProjectOperatorFactory(context.getNextOperatorId(), FilterFunctions.TRUE_FUNCTION, mappings.getProjections());
            return new PhysicalOperation(operatorFactory, mappings.getOutputLayout(), source);
        }
View Full Code Here

                        projectionFunctions);

                return new PhysicalOperation(operatorFactory, outputMappings);
            }
            else {
                OperatorFactory operatorFactory = new FilterAndProjectOperatorFactory(context.getNextOperatorId(), filterFunction, projectionFunctions);
                return new PhysicalOperation(operatorFactory, outputMappings, source);
            }
        }
View Full Code Here

                    .list()
                    .equals(node.getOutputSymbols());

            if (!projectionMatchesOutput) {
                IdentityProjectionInfo mappings = computeIdentityMapping(node.getOutputSymbols(), source.getLayout(), context.getTypes());
                OperatorFactory operatorFactory = new FilterAndProjectOperatorFactory(context.getNextOperatorId(), FilterFunctions.TRUE_FUNCTION, mappings.getProjections());
                // NOTE: the generated output layout may not be completely accurate if the same field was projected as multiple inputs.
                // However, this should not affect the operation of the sink.
                return new PhysicalOperation(operatorFactory, mappings.getOutputLayout(), source);
            }
View Full Code Here

                        .list()
                        .equals(expectedLayout);

                if (!projectionMatchesOutput) {
                    IdentityProjectionInfo mappings = computeIdentityMapping(expectedLayout, source.getLayout(), context.getTypes());
                    operatorFactories.add(new FilterAndProjectOperatorFactory(subContext.getNextOperatorId(), FilterFunctions.TRUE_FUNCTION, mappings.getProjections()));
                }

                operatorFactories.add(inMemoryExchange.createSinkFactory(subContext.getNextOperatorId()));

                DriverFactory driverFactory = new DriverFactory(subContext.isInputDriver(), false, operatorFactories);
View Full Code Here

                INPUT_MAPPING,
                new MetadataManager(),
                session
        );

        OperatorFactory operatorFactory = new FilterAndProjectOperatorFactory(0, filterFunction, ImmutableList.of(projectionFunction));
        return operatorFactory.createOperator(createDriverContext(session));
    }
View Full Code Here

TOP

Related Classes of com.facebook.presto.operator.FilterAndProjectOperator.FilterAndProjectOperatorFactory

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.