Search in sources :

Example 1 with TpchQuery1OperatorFactory

use of com.facebook.presto.benchmark.HandTpchQuery1.TpchQuery1Operator.TpchQuery1OperatorFactory 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)

Aggregations

TpchQuery1OperatorFactory (com.facebook.presto.benchmark.HandTpchQuery1.TpchQuery1Operator.TpchQuery1OperatorFactory)1 HashAggregationOperatorFactory (com.facebook.presto.operator.HashAggregationOperator.HashAggregationOperatorFactory)1 OperatorFactory (com.facebook.presto.operator.OperatorFactory)1 PlanNodeId (com.facebook.presto.sql.planner.plan.PlanNodeId)1 DataSize (io.airlift.units.DataSize)1