Search in sources :

Example 6 with OperatorFactory

use of io.prestosql.operator.OperatorFactory in project hetu-core by openlookeng.

the class OrderByBenchmark method createOperatorFactories.

@Override
protected List<? extends OperatorFactory> createOperatorFactories() {
    List<Type> tableScanTypes = getColumnTypes("orders", "totalprice", "clerk");
    OperatorFactory tableScanOperator = createTableScanOperator(0, new PlanNodeId("test"), "orders", "totalprice", "clerk");
    LimitOperatorFactory limitOperator = new LimitOperatorFactory(1, new PlanNodeId("test"), ROWS);
    OrderByOperatorFactory orderByOperator = new OrderByOperatorFactory(2, new PlanNodeId("test"), tableScanTypes, ImmutableList.of(1), ROWS, ImmutableList.of(0), ImmutableList.of(ASC_NULLS_LAST), new PagesIndex.TestingFactory(false), false, Optional.empty(), new OrderingCompiler(), false);
    return ImmutableList.of(tableScanOperator, limitOperator, orderByOperator);
}
Also used : PlanNodeId(io.prestosql.spi.plan.PlanNodeId) Type(io.prestosql.spi.type.Type) LimitOperatorFactory(io.prestosql.operator.LimitOperator.LimitOperatorFactory) LimitOperatorFactory(io.prestosql.operator.LimitOperator.LimitOperatorFactory) OperatorFactory(io.prestosql.operator.OperatorFactory) OrderByOperatorFactory(io.prestosql.operator.OrderByOperator.OrderByOperatorFactory) OrderByOperatorFactory(io.prestosql.operator.OrderByOperator.OrderByOperatorFactory) OrderingCompiler(io.prestosql.sql.gen.OrderingCompiler) PagesIndex(io.prestosql.operator.PagesIndex)

Example 7 with OperatorFactory

use of io.prestosql.operator.OperatorFactory in project hetu-core by openlookeng.

the class DoubleSumAggregationBenchmark method createOperatorFactories.

@Override
protected List<? extends OperatorFactory> createOperatorFactories() {
    OperatorFactory tableScanOperator = createTableScanOperator(0, new PlanNodeId("test"), "orders", "totalprice");
    InternalAggregationFunction doubleSum = createTestMetadataManager().getFunctionAndTypeManager().getAggregateFunctionImplementation(new Signature(QualifiedObjectName.valueOfDefaultFunction("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())), false);
    return ImmutableList.of(tableScanOperator, aggregationOperator);
}
Also used : PlanNodeId(io.prestosql.spi.plan.PlanNodeId) OperatorFactory(io.prestosql.operator.OperatorFactory) AggregationOperatorFactory(io.prestosql.operator.AggregationOperator.AggregationOperatorFactory) AggregationOperatorFactory(io.prestosql.operator.AggregationOperator.AggregationOperatorFactory) Signature(io.prestosql.spi.function.Signature) InternalAggregationFunction(io.prestosql.operator.aggregation.InternalAggregationFunction)

Example 8 with OperatorFactory

use of io.prestosql.operator.OperatorFactory in project hetu-core by openlookeng.

the class AbstractSimpleOperatorBenchmark method createDriverFactory.

protected DriverFactory createDriverFactory() {
    List<OperatorFactory> operatorFactories = new ArrayList<>(createOperatorFactories());
    operatorFactories.add(new NullOutputOperatorFactory(999, new PlanNodeId("test")));
    return new DriverFactory(0, true, true, operatorFactories, OptionalInt.empty(), UNGROUPED_EXECUTION);
}
Also used : PlanNodeId(io.prestosql.spi.plan.PlanNodeId) OperatorFactory(io.prestosql.operator.OperatorFactory) NullOutputOperatorFactory(io.prestosql.testing.NullOutputOperator.NullOutputOperatorFactory) ArrayList(java.util.ArrayList) DriverFactory(io.prestosql.operator.DriverFactory) NullOutputOperatorFactory(io.prestosql.testing.NullOutputOperator.NullOutputOperatorFactory)

Example 9 with OperatorFactory

use of io.prestosql.operator.OperatorFactory in project hetu-core by openlookeng.

the class TestSpatialJoinOperator method assertSpatialJoinSnapshot.

private void assertSpatialJoinSnapshot(TaskContext taskContext, Type joinType, RowPagesBuilder buildPages, RowPagesBuilder probePages, MaterializedResult expected) {
    DriverContext driverContext = taskContext.addPipelineContext(0, true, true, false).addDriverContext();
    PagesSpatialIndexFactory pagesSpatialIndexFactory = buildIndexSnapshot(driverContext, (build, probe, r) -> build.contains(probe), Optional.empty(), Optional.empty(), buildPages);
    OperatorFactory joinOperatorFactory = new SpatialJoinOperatorFactory(2, new PlanNodeId("test"), joinType, probePages.getTypes(), Ints.asList(1), 0, Optional.empty(), pagesSpatialIndexFactory);
    assetResultEqualsSnapshot(joinOperatorFactory, driverContext, probePages.build(), expected);
}
Also used : SpatialJoinOperatorFactory(io.prestosql.operator.SpatialJoinOperator.SpatialJoinOperatorFactory) PlanNodeId(io.prestosql.spi.plan.PlanNodeId) DriverContext(io.prestosql.operator.DriverContext) SpatialJoinOperatorFactory(io.prestosql.operator.SpatialJoinOperator.SpatialJoinOperatorFactory) OperatorFactory(io.prestosql.operator.OperatorFactory) SpatialIndexBuilderOperatorFactory(io.prestosql.operator.SpatialIndexBuilderOperator.SpatialIndexBuilderOperatorFactory) PagesSpatialIndexFactory(io.prestosql.operator.PagesSpatialIndexFactory)

Example 10 with OperatorFactory

use of io.prestosql.operator.OperatorFactory in project hetu-core by openlookeng.

the class TestSpatialJoinOperator method testDistanceQuery.

@Test
public void testDistanceQuery() {
    TaskContext taskContext = createTaskContext();
    DriverContext driverContext = taskContext.addPipelineContext(0, true, true, false).addDriverContext();
    RowPagesBuilder buildPages = rowPagesBuilder(ImmutableList.of(GEOMETRY, VARCHAR, DOUBLE)).row(stPoint(0, 0), "0_0", 1.5).row(null, "null", 1.5).row(stPoint(1, 0), "1_0", 1.5).pageBreak().row(stPoint(3, 0), "3_0", 1.5).pageBreak().row(stPoint(10, 0), "10_0", 1.5);
    PagesSpatialIndexFactory pagesSpatialIndexFactory = buildIndex(driverContext, (build, probe, r) -> build.distance(probe) <= r.getAsDouble(), Optional.of(2), Optional.empty(), buildPages);
    RowPagesBuilder probePages = rowPagesBuilder(ImmutableList.of(GEOMETRY, VARCHAR)).row(stPoint(0, 1), "0_1").row(null, "null").row(stPoint(1, 1), "1_1").pageBreak().row(stPoint(3, 1), "3_1").pageBreak().row(stPoint(10, 1), "10_1");
    OperatorFactory joinOperatorFactory = new SpatialJoinOperatorFactory(2, new PlanNodeId("test"), INNER, probePages.getTypes(), Ints.asList(1), 0, Optional.empty(), pagesSpatialIndexFactory);
    MaterializedResult expected = resultBuilder(taskContext.getSession(), ImmutableList.of(VARCHAR, VARCHAR)).row("0_1", "0_0").row("0_1", "1_0").row("1_1", "0_0").row("1_1", "1_0").row("3_1", "3_0").row("10_1", "10_0").build();
    assertOperatorEquals(joinOperatorFactory, driverContext, probePages.build(), expected);
}
Also used : SpatialJoinOperatorFactory(io.prestosql.operator.SpatialJoinOperator.SpatialJoinOperatorFactory) PlanNodeId(io.prestosql.spi.plan.PlanNodeId) DriverContext(io.prestosql.operator.DriverContext) TaskContext(io.prestosql.operator.TaskContext) TestingTaskContext(io.prestosql.testing.TestingTaskContext) RowPagesBuilder(io.prestosql.RowPagesBuilder) SpatialJoinOperatorFactory(io.prestosql.operator.SpatialJoinOperator.SpatialJoinOperatorFactory) OperatorFactory(io.prestosql.operator.OperatorFactory) SpatialIndexBuilderOperatorFactory(io.prestosql.operator.SpatialIndexBuilderOperator.SpatialIndexBuilderOperatorFactory) PagesSpatialIndexFactory(io.prestosql.operator.PagesSpatialIndexFactory) MaterializedResult(io.prestosql.testing.MaterializedResult) OperatorAssertion.toMaterializedResult(io.prestosql.operator.OperatorAssertion.toMaterializedResult) Test(org.testng.annotations.Test)

Aggregations

OperatorFactory (io.prestosql.operator.OperatorFactory)36 PlanNodeId (io.prestosql.spi.plan.PlanNodeId)28 Type (io.prestosql.spi.type.Type)14 DriverContext (io.prestosql.operator.DriverContext)12 MaterializedResult (io.prestosql.testing.MaterializedResult)12 Test (org.testng.annotations.Test)11 DriverFactory (io.prestosql.operator.DriverFactory)9 SpatialIndexBuilderOperatorFactory (io.prestosql.operator.SpatialIndexBuilderOperator.SpatialIndexBuilderOperatorFactory)9 SpatialJoinOperatorFactory (io.prestosql.operator.SpatialJoinOperator.SpatialJoinOperatorFactory)9 Page (io.prestosql.spi.Page)9 PagesSpatialIndexFactory (io.prestosql.operator.PagesSpatialIndexFactory)7 ImmutableList (com.google.common.collect.ImmutableList)6 Metadata (io.prestosql.metadata.Metadata)6 SourceOperatorFactory (io.prestosql.operator.SourceOperatorFactory)6 TaskContext (io.prestosql.operator.TaskContext)6 ArrayList (java.util.ArrayList)6 RowPagesBuilder (io.prestosql.RowPagesBuilder)5 AggregationOperatorFactory (io.prestosql.operator.AggregationOperator.AggregationOperatorFactory)5 HashBuilderOperatorFactory (io.prestosql.operator.HashBuilderOperator.HashBuilderOperatorFactory)5 OperatorAssertion.toMaterializedResult (io.prestosql.operator.OperatorAssertion.toMaterializedResult)5