Search in sources :

Example 11 with OperatorFactory

use of com.facebook.presto.operator.OperatorFactory in project presto by prestodb.

the class IndexBuildDriverFactoryProvider method createStreaming.

public DriverFactory createStreaming(PageBuffer pageBuffer, Page indexKeyTuple) {
    ImmutableList.Builder<OperatorFactory> operatorFactories = ImmutableList.<OperatorFactory>builder().addAll(coreOperatorFactories);
    if (dynamicTupleFilterFactory.isPresent()) {
        // Bind in a dynamic tuple filter if necessary
        operatorFactories.add(dynamicTupleFilterFactory.get().filterWithTuple(indexKeyTuple));
    }
    operatorFactories.add(new PageBufferOperatorFactory(outputOperatorId, planNodeId, pageBuffer));
    return new DriverFactory(pipelineId, inputDriver, false, operatorFactories.build(), OptionalInt.empty());
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) PageBufferOperatorFactory(com.facebook.presto.operator.index.PageBufferOperator.PageBufferOperatorFactory) OperatorFactory(com.facebook.presto.operator.OperatorFactory) PagesIndexBuilderOperatorFactory(com.facebook.presto.operator.index.PagesIndexBuilderOperator.PagesIndexBuilderOperatorFactory) DriverFactory(com.facebook.presto.operator.DriverFactory) PageBufferOperatorFactory(com.facebook.presto.operator.index.PageBufferOperator.PageBufferOperatorFactory)

Example 12 with OperatorFactory

use of com.facebook.presto.operator.OperatorFactory in project presto by prestodb.

the class AbstractSimpleOperatorBenchmark method createDriverFactory.

protected DriverFactory createDriverFactory() {
    List<OperatorFactory> operatorFactories = new ArrayList<>(createOperatorFactories());
    operatorFactories.add(new NullOutputOperatorFactory(999, new PlanNodeId("test"), Iterables.getLast(operatorFactories).getTypes()));
    return new DriverFactory(0, true, true, operatorFactories, OptionalInt.empty());
}
Also used : PlanNodeId(com.facebook.presto.sql.planner.plan.PlanNodeId) OperatorFactory(com.facebook.presto.operator.OperatorFactory) NullOutputOperatorFactory(com.facebook.presto.testing.NullOutputOperator.NullOutputOperatorFactory) ArrayList(java.util.ArrayList) DriverFactory(com.facebook.presto.operator.DriverFactory) NullOutputOperatorFactory(com.facebook.presto.testing.NullOutputOperator.NullOutputOperatorFactory)

Example 13 with OperatorFactory

use of com.facebook.presto.operator.OperatorFactory in project presto by prestodb.

the class DoubleSumAggregationBenchmark method createOperatorFactories.

@Override
protected List<? extends OperatorFactory> createOperatorFactories() {
    OperatorFactory tableScanOperator = createTableScanOperator(0, new PlanNodeId("test"), "orders", "totalprice");
    InternalAggregationFunction doubleSum = MetadataManager.createTestMetadataManager().getFunctionRegistry().getAggregateFunctionImplementation(new Signature("sum", AGGREGATE, DOUBLE.getTypeSignature(), DOUBLE.getTypeSignature()));
    AggregationOperatorFactory aggregationOperator = new AggregationOperatorFactory(1, new PlanNodeId("test"), Step.SINGLE, ImmutableList.of(doubleSum.bind(ImmutableList.of(0), Optional.empty())));
    return ImmutableList.of(tableScanOperator, aggregationOperator);
}
Also used : PlanNodeId(com.facebook.presto.sql.planner.plan.PlanNodeId) OperatorFactory(com.facebook.presto.operator.OperatorFactory) AggregationOperatorFactory(com.facebook.presto.operator.AggregationOperator.AggregationOperatorFactory) AggregationOperatorFactory(com.facebook.presto.operator.AggregationOperator.AggregationOperatorFactory) Signature(com.facebook.presto.metadata.Signature) InternalAggregationFunction(com.facebook.presto.operator.aggregation.InternalAggregationFunction)

Example 14 with OperatorFactory

use of com.facebook.presto.operator.OperatorFactory in project presto by prestodb.

the class HandTpchQuery1 method createOperatorFactories.

@Override
protected List<? extends OperatorFactory> createOperatorFactories() {
    // select
    //     returnflag,
    //     linestatus,
    //     sum(quantity) as sum_qty,
    //     sum(extendedprice) as sum_base_price,
    //     sum(extendedprice * (1 - discount)) as sum_disc_price,
    //     sum(extendedprice * (1 - discount) * (1 + tax)) as sum_charge,
    //     avg(quantity) as avg_qty,
    //     avg(extendedprice) as avg_price,
    //     avg(discount) as avg_disc,
    //     count(*) as count_order
    // from
    //     lineitem
    // where
    //     shipdate <= '1998-09-02'
    // group by
    //     returnflag,
    //     linestatus
    // order by
    //     returnflag,
    //     linestatus
    OperatorFactory tableScanOperator = createTableScanOperator(0, new PlanNodeId("test"), "lineitem", "returnflag", "linestatus", "quantity", "extendedprice", "discount", "tax", "shipdate");
    TpchQuery1OperatorFactory tpchQuery1Operator = new TpchQuery1OperatorFactory(1);
    HashAggregationOperatorFactory aggregationOperator = new HashAggregationOperatorFactory(2, new PlanNodeId("test"), ImmutableList.of(tpchQuery1Operator.getTypes().get(0), tpchQuery1Operator.getTypes().get(1)), Ints.asList(0, 1), ImmutableList.of(), Step.SINGLE, ImmutableList.of(doubleSum.bind(ImmutableList.of(2), Optional.empty()), doubleSum.bind(ImmutableList.of(3), Optional.empty()), doubleSum.bind(ImmutableList.of(4), Optional.empty()), longAverage.bind(ImmutableList.of(2), Optional.empty()), doubleAverage.bind(ImmutableList.of(5), Optional.empty()), doubleAverage.bind(ImmutableList.of(6), Optional.empty()), countFunction.bind(ImmutableList.of(2), Optional.empty())), Optional.empty(), Optional.empty(), 10_000, new DataSize(16, MEGABYTE), JOIN_COMPILER);
    return ImmutableList.of(tableScanOperator, tpchQuery1Operator, aggregationOperator);
}
Also used : PlanNodeId(com.facebook.presto.sql.planner.plan.PlanNodeId) OperatorFactory(com.facebook.presto.operator.OperatorFactory) TpchQuery1OperatorFactory(com.facebook.presto.benchmark.HandTpchQuery1.TpchQuery1Operator.TpchQuery1OperatorFactory) HashAggregationOperatorFactory(com.facebook.presto.operator.HashAggregationOperator.HashAggregationOperatorFactory) TpchQuery1OperatorFactory(com.facebook.presto.benchmark.HandTpchQuery1.TpchQuery1Operator.TpchQuery1OperatorFactory) DataSize(io.airlift.units.DataSize) HashAggregationOperatorFactory(com.facebook.presto.operator.HashAggregationOperator.HashAggregationOperatorFactory)

Example 15 with OperatorFactory

use of com.facebook.presto.operator.OperatorFactory in project presto by prestodb.

the class HandTpchQuery6 method createOperatorFactories.

@Override
protected List<? extends OperatorFactory> createOperatorFactories() {
    // select sum(extendedprice * discount) as revenue
    // from lineitem
    // where shipdate >= '1994-01-01'
    //    and shipdate < '1995-01-01'
    //    and discount >= 0.05
    //    and discount <= 0.07
    //    and quantity < 24;
    OperatorFactory tableScanOperator = createTableScanOperator(0, new PlanNodeId("test"), "lineitem", "extendedprice", "discount", "shipdate", "quantity");
    FilterAndProjectOperator.FilterAndProjectOperatorFactory tpchQuery6Operator = new FilterAndProjectOperator.FilterAndProjectOperatorFactory(1, new PlanNodeId("test"), () -> new TpchQuery6Processor(), ImmutableList.of(DOUBLE));
    AggregationOperatorFactory aggregationOperator = new AggregationOperatorFactory(2, new PlanNodeId("test"), Step.SINGLE, ImmutableList.of(doubleSum.bind(ImmutableList.of(0), Optional.empty())));
    return ImmutableList.of(tableScanOperator, tpchQuery6Operator, aggregationOperator);
}
Also used : PlanNodeId(com.facebook.presto.sql.planner.plan.PlanNodeId) OperatorFactory(com.facebook.presto.operator.OperatorFactory) AggregationOperatorFactory(com.facebook.presto.operator.AggregationOperator.AggregationOperatorFactory) AggregationOperatorFactory(com.facebook.presto.operator.AggregationOperator.AggregationOperatorFactory) FilterAndProjectOperator(com.facebook.presto.operator.FilterAndProjectOperator)

Aggregations

OperatorFactory (com.facebook.presto.operator.OperatorFactory)19 PlanNodeId (com.facebook.presto.sql.planner.plan.PlanNodeId)13 DriverFactory (com.facebook.presto.operator.DriverFactory)7 AggregationOperatorFactory (com.facebook.presto.operator.AggregationOperator.AggregationOperatorFactory)5 HashBuilderOperatorFactory (com.facebook.presto.operator.HashBuilderOperator.HashBuilderOperatorFactory)5 SourceOperatorFactory (com.facebook.presto.operator.SourceOperatorFactory)5 ImmutableList (com.google.common.collect.ImmutableList)5 HashAggregationOperatorFactory (com.facebook.presto.operator.HashAggregationOperator.HashAggregationOperatorFactory)4 PagesIndex (com.facebook.presto.operator.PagesIndex)4 NullOutputOperatorFactory (com.facebook.presto.testing.NullOutputOperator.NullOutputOperatorFactory)4 Driver (com.facebook.presto.operator.Driver)3 FilterAndProjectOperator (com.facebook.presto.operator.FilterAndProjectOperator)3 LimitOperatorFactory (com.facebook.presto.operator.LimitOperator.LimitOperatorFactory)3 OrderByOperatorFactory (com.facebook.presto.operator.OrderByOperator.OrderByOperatorFactory)3 ValuesOperatorFactory (com.facebook.presto.operator.ValuesOperator.ValuesOperatorFactory)3 Signature (com.facebook.presto.metadata.Signature)2 DeleteOperatorFactory (com.facebook.presto.operator.DeleteOperator.DeleteOperatorFactory)2 DistinctLimitOperatorFactory (com.facebook.presto.operator.DistinctLimitOperator.DistinctLimitOperatorFactory)2 DriverContext (com.facebook.presto.operator.DriverContext)2 ExchangeOperatorFactory (com.facebook.presto.operator.ExchangeOperator.ExchangeOperatorFactory)2