Search in sources :

Example 1 with LookupSourceProvider

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

the class HashJoinBenchmark method createDrivers.

/*
    select orderkey, quantity, totalprice
    from lineitem join orders using (orderkey)
     */
@Override
protected List<Driver> createDrivers(TaskContext taskContext) {
    if (probeDriverFactory == null) {
        List<Type> ordersTypes = getColumnTypes("orders", "orderkey", "totalprice");
        OperatorFactory ordersTableScan = createTableScanOperator(0, new PlanNodeId("test"), "orders", "orderkey", "totalprice");
        JoinBridgeManager<PartitionedLookupSourceFactory> lookupSourceFactoryManager = JoinBridgeManager.lookupAllAtOnce(new PartitionedLookupSourceFactory(ordersTypes, ImmutableList.of(0, 1).stream().map(ordersTypes::get).collect(toImmutableList()), Ints.asList(0).stream().map(ordersTypes::get).collect(toImmutableList()), 1, requireNonNull(ImmutableMap.of(), "layout is null"), false, false));
        HashBuilderOperatorFactory hashBuilder = new HashBuilderOperatorFactory(1, new PlanNodeId("test"), lookupSourceFactoryManager, ImmutableList.of(0, 1), Ints.asList(0), OptionalInt.empty(), Optional.empty(), Optional.empty(), ImmutableList.of(), 1_500_000, new PagesIndex.TestingFactory(false), false, SingleStreamSpillerFactory.unsupportedSingleStreamSpillerFactory());
        DriverContext driverContext = taskContext.addPipelineContext(0, false, false, false).addDriverContext();
        DriverFactory buildDriverFactory = new DriverFactory(0, false, false, ImmutableList.of(ordersTableScan, hashBuilder), OptionalInt.empty(), UNGROUPED_EXECUTION);
        List<Type> lineItemTypes = getColumnTypes("lineitem", "orderkey", "quantity");
        OperatorFactory lineItemTableScan = createTableScanOperator(0, new PlanNodeId("test"), "lineitem", "orderkey", "quantity");
        OperatorFactory joinOperator = LOOKUP_JOIN_OPERATORS.innerJoin(1, new PlanNodeId("test"), lookupSourceFactoryManager, lineItemTypes, Ints.asList(0), OptionalInt.empty(), Optional.empty(), OptionalInt.empty(), unsupportedPartitioningSpillerFactory());
        NullOutputOperatorFactory output = new NullOutputOperatorFactory(2, new PlanNodeId("test"));
        this.probeDriverFactory = new DriverFactory(1, true, true, ImmutableList.of(lineItemTableScan, joinOperator, output), OptionalInt.empty(), UNGROUPED_EXECUTION);
        Driver driver = buildDriverFactory.createDriver(driverContext);
        Future<LookupSourceProvider> lookupSourceProvider = lookupSourceFactoryManager.getJoinBridge(Lifespan.taskWide()).createLookupSourceProvider();
        while (!lookupSourceProvider.isDone()) {
            driver.process();
        }
        getFutureValue(lookupSourceProvider).close();
    }
    DriverContext driverContext = taskContext.addPipelineContext(1, true, true, false).addDriverContext();
    Driver driver = probeDriverFactory.createDriver(driverContext);
    return ImmutableList.of(driver);
}
Also used : DriverContext(io.prestosql.operator.DriverContext) HashBuilderOperatorFactory(io.prestosql.operator.HashBuilderOperator.HashBuilderOperatorFactory) Driver(io.prestosql.operator.Driver) PagesIndex(io.prestosql.operator.PagesIndex) PlanNodeId(io.prestosql.spi.plan.PlanNodeId) Type(io.prestosql.spi.type.Type) HashBuilderOperatorFactory(io.prestosql.operator.HashBuilderOperator.HashBuilderOperatorFactory) OperatorFactory(io.prestosql.operator.OperatorFactory) NullOutputOperatorFactory(io.prestosql.testing.NullOutputOperator.NullOutputOperatorFactory) DriverFactory(io.prestosql.operator.DriverFactory) PartitionedLookupSourceFactory(io.prestosql.operator.PartitionedLookupSourceFactory) NullOutputOperatorFactory(io.prestosql.testing.NullOutputOperator.NullOutputOperatorFactory) LookupSourceProvider(io.prestosql.operator.LookupSourceProvider)

Aggregations

Driver (io.prestosql.operator.Driver)1 DriverContext (io.prestosql.operator.DriverContext)1 DriverFactory (io.prestosql.operator.DriverFactory)1 HashBuilderOperatorFactory (io.prestosql.operator.HashBuilderOperator.HashBuilderOperatorFactory)1 LookupSourceProvider (io.prestosql.operator.LookupSourceProvider)1 OperatorFactory (io.prestosql.operator.OperatorFactory)1 PagesIndex (io.prestosql.operator.PagesIndex)1 PartitionedLookupSourceFactory (io.prestosql.operator.PartitionedLookupSourceFactory)1 PlanNodeId (io.prestosql.spi.plan.PlanNodeId)1 Type (io.prestosql.spi.type.Type)1 NullOutputOperatorFactory (io.prestosql.testing.NullOutputOperator.NullOutputOperatorFactory)1