Search in sources :

Example 16 with JoinCompiler

use of io.trino.sql.gen.JoinCompiler in project trino by trinodb.

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"), getColumnTypes("lineitem", "returnflag", "linestatus"), Ints.asList(0, 1), ImmutableList.of(), Step.SINGLE, ImmutableList.of(doubleSum.bind(ImmutableList.of(2)), doubleSum.bind(ImmutableList.of(3)), doubleSum.bind(ImmutableList.of(4)), longAverage.bind(ImmutableList.of(2)), doubleAverage.bind(ImmutableList.of(5)), doubleAverage.bind(ImmutableList.of(6)), countFunction.bind(ImmutableList.of(2))), Optional.empty(), Optional.empty(), 10_000, Optional.of(DataSize.of(16, MEGABYTE)), new JoinCompiler(localQueryRunner.getTypeOperators()), localQueryRunner.getBlockTypeOperators(), Optional.empty());
    return ImmutableList.of(tableScanOperator, tpchQuery1Operator, aggregationOperator);
}
Also used : PlanNodeId(io.trino.sql.planner.plan.PlanNodeId) JoinCompiler(io.trino.sql.gen.JoinCompiler) TpchQuery1OperatorFactory(io.trino.benchmark.HandTpchQuery1.TpchQuery1Operator.TpchQuery1OperatorFactory) OperatorFactory(io.trino.operator.OperatorFactory) HashAggregationOperatorFactory(io.trino.operator.HashAggregationOperator.HashAggregationOperatorFactory) TpchQuery1OperatorFactory(io.trino.benchmark.HandTpchQuery1.TpchQuery1Operator.TpchQuery1OperatorFactory) HashAggregationOperatorFactory(io.trino.operator.HashAggregationOperator.HashAggregationOperatorFactory)

Example 17 with JoinCompiler

use of io.trino.sql.gen.JoinCompiler in project trino by trinodb.

the class HashAggregationBenchmark method createOperatorFactories.

@Override
protected List<? extends OperatorFactory> createOperatorFactories() {
    List<Type> tableTypes = getColumnTypes("orders", "orderstatus", "totalprice");
    OperatorFactory tableScanOperator = createTableScanOperator(0, new PlanNodeId("test"), "orders", "orderstatus", "totalprice");
    HashAggregationOperatorFactory aggregationOperator = new HashAggregationOperatorFactory(1, new PlanNodeId("test"), ImmutableList.of(tableTypes.get(0)), Ints.asList(0), ImmutableList.of(), Step.SINGLE, ImmutableList.of(doubleSum.bind(ImmutableList.of(1))), Optional.empty(), Optional.empty(), 100_000, Optional.of(DataSize.of(16, MEGABYTE)), new JoinCompiler(localQueryRunner.getTypeOperators()), localQueryRunner.getBlockTypeOperators(), Optional.empty());
    return ImmutableList.of(tableScanOperator, aggregationOperator);
}
Also used : PlanNodeId(io.trino.sql.planner.plan.PlanNodeId) JoinCompiler(io.trino.sql.gen.JoinCompiler) Type(io.trino.spi.type.Type) HashAggregationOperatorFactory(io.trino.operator.HashAggregationOperator.HashAggregationOperatorFactory) OperatorFactory(io.trino.operator.OperatorFactory) HashAggregationOperatorFactory(io.trino.operator.HashAggregationOperator.HashAggregationOperatorFactory)

Aggregations

JoinCompiler (io.trino.sql.gen.JoinCompiler)17 PlanNodeId (io.trino.sql.planner.plan.PlanNodeId)12 Test (org.testng.annotations.Test)8 RowPagesBuilder (io.trino.RowPagesBuilder)7 SetBuilderOperatorFactory (io.trino.operator.SetBuilderOperator.SetBuilderOperatorFactory)7 Page (io.trino.spi.Page)7 Type (io.trino.spi.type.Type)7 TypeOperators (io.trino.spi.type.TypeOperators)6 MaterializedResult (io.trino.testing.MaterializedResult)6 BlockTypeOperators (io.trino.type.BlockTypeOperators)5 GroupByHashPageIndexerFactory (io.trino.operator.GroupByHashPageIndexerFactory)3 BeforeMethod (org.testng.annotations.BeforeMethod)3 HashAggregationOperatorFactory (io.trino.operator.HashAggregationOperator.HashAggregationOperatorFactory)2 OperatorFactory (io.trino.operator.OperatorFactory)2 SchemaTableName (io.trino.spi.connector.SchemaTableName)2 TestingNodeManager (io.trino.testing.TestingNodeManager)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 HostAndPort (com.google.common.net.HostAndPort)1 BoundedExecutor (io.airlift.concurrent.BoundedExecutor)1