Search in sources :

Example 6 with HashBuilderOperatorFactory

use of com.facebook.presto.operator.HashBuilderOperator.HashBuilderOperatorFactory in project presto by prestodb.

the class BenchmarkHashBuildAndJoinOperators method benchmarkBuildHash.

private JoinBridgeManager<PartitionedLookupSourceFactory> benchmarkBuildHash(BuildContext buildContext, List<Integer> outputChannels) {
    DriverContext driverContext = buildContext.createTaskContext().addPipelineContext(0, true, true, false).addDriverContext();
    JoinBridgeManager<PartitionedLookupSourceFactory> lookupSourceFactoryManager = JoinBridgeManager.lookupAllAtOnce(new PartitionedLookupSourceFactory(buildContext.getTypes(), outputChannels.stream().map(buildContext.getTypes()::get).collect(toImmutableList()), buildContext.getHashChannels().stream().map(buildContext.getTypes()::get).collect(toImmutableList()), 1, requireNonNull(ImmutableMap.of(), "layout is null"), false));
    HashBuilderOperatorFactory hashBuilderOperatorFactory = new HashBuilderOperatorFactory(HASH_BUILD_OPERATOR_ID, TEST_PLAN_NODE_ID, lookupSourceFactoryManager, outputChannels, buildContext.getHashChannels(), buildContext.getHashChannel(), Optional.empty(), Optional.empty(), ImmutableList.of(), 10_000, new PagesIndex.TestingFactory(false), false, SingleStreamSpillerFactory.unsupportedSingleStreamSpillerFactory(), false);
    Operator operator = hashBuilderOperatorFactory.createOperator(driverContext);
    for (Page page : buildContext.getBuildPages()) {
        operator.addInput(page);
    }
    operator.finish();
    LookupSourceFactory lookupSourceFactory = lookupSourceFactoryManager.getJoinBridge(Lifespan.taskWide());
    ListenableFuture<LookupSourceProvider> lookupSourceProvider = lookupSourceFactory.createLookupSourceProvider();
    if (!lookupSourceProvider.isDone()) {
        throw new AssertionError("Expected lookup source provider to be ready");
    }
    getFutureValue(lookupSourceProvider).close();
    return lookupSourceFactoryManager;
}
Also used : HashBuilderOperatorFactory(com.facebook.presto.operator.HashBuilderOperator.HashBuilderOperatorFactory) Page(com.facebook.presto.common.Page)

Aggregations

HashBuilderOperatorFactory (com.facebook.presto.operator.HashBuilderOperator.HashBuilderOperatorFactory)6 PlanNodeId (com.facebook.presto.spi.plan.PlanNodeId)4 Type (com.facebook.presto.common.type.Type)3 Driver (com.facebook.presto.operator.Driver)3 DriverFactory (com.facebook.presto.operator.DriverFactory)3 OperatorFactory (com.facebook.presto.operator.OperatorFactory)3 PagesIndex (com.facebook.presto.operator.PagesIndex)3 PartitionedLookupSourceFactory (com.facebook.presto.operator.PartitionedLookupSourceFactory)3 ValuesOperatorFactory (com.facebook.presto.operator.ValuesOperator.ValuesOperatorFactory)3 NullOutputOperatorFactory (com.facebook.presto.testing.NullOutputOperator.NullOutputOperatorFactory)3 ImmutableList (com.google.common.collect.ImmutableList)3 LocalExchangeSinkOperatorFactory (com.facebook.presto.operator.exchange.LocalExchangeSinkOperator.LocalExchangeSinkOperatorFactory)2 LocalExchangeSourceOperatorFactory (com.facebook.presto.operator.exchange.LocalExchangeSourceOperator.LocalExchangeSourceOperatorFactory)2 JoinFilterFunctionFactory (com.facebook.presto.sql.gen.JoinFilterFunctionCompiler.JoinFilterFunctionFactory)2 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)2 DataSize (io.airlift.units.DataSize)2 OptionalInt (java.util.OptionalInt)2 ExceededMemoryLimitException (com.facebook.presto.ExceededMemoryLimitException)1 RowPagesBuilder (com.facebook.presto.RowPagesBuilder)1 RowPagesBuilder.rowPagesBuilder (com.facebook.presto.RowPagesBuilder.rowPagesBuilder)1