Search in sources :

Example 11 with PartitioningScheme

use of io.prestosql.sql.planner.PartitioningScheme in project hetu-core by openlookeng.

the class MockRemoteTaskFactory method createTableScanTask.

public MockRemoteTask createTableScanTask(TaskId taskId, InternalNode newNode, List<Split> splits, PartitionedSplitCountTracker partitionedSplitCountTracker) {
    // for now, just use a filler instanceId for tests
    String instanceId = "testInstanceId";
    Symbol symbol = new Symbol("column");
    PlanNodeId sourceId = new PlanNodeId("sourceId");
    PlanFragment testFragment = new PlanFragment(new PlanFragmentId("test"), TableScanNode.newInstance(sourceId, TEST_TABLE_HANDLE, ImmutableList.of(symbol), ImmutableMap.of(symbol, new TestingColumnHandle("column")), ReuseExchangeOperator.STRATEGY.REUSE_STRATEGY_DEFAULT, new UUID(0, 0), 0, false), ImmutableMap.of(symbol, VARCHAR), SOURCE_DISTRIBUTION, ImmutableList.of(sourceId), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), ImmutableList.of(symbol)), ungroupedExecution(), StatsAndCosts.empty(), Optional.empty(), Optional.empty(), Optional.empty());
    ImmutableMultimap.Builder<PlanNodeId, Split> initialSplits = ImmutableMultimap.builder();
    for (Split sourceSplit : splits) {
        initialSplits.put(sourceId, sourceSplit);
    }
    return createRemoteTask(TEST_SESSION, taskId, instanceId, newNode, testFragment, initialSplits.build(), OptionalInt.empty(), createInitialEmptyOutputBuffers(BROADCAST), partitionedSplitCountTracker, true, Optional.empty(), new QuerySnapshotManager(taskId.getQueryId(), NOOP_SNAPSHOT_UTILS, TEST_SESSION));
}
Also used : PlanNodeId(io.prestosql.spi.plan.PlanNodeId) TestingColumnHandle(io.prestosql.testing.TestingMetadata.TestingColumnHandle) Symbol(io.prestosql.spi.plan.Symbol) PartitioningScheme(io.prestosql.sql.planner.PartitioningScheme) PlanFragmentId(io.prestosql.sql.planner.plan.PlanFragmentId) ImmutableMultimap(com.google.common.collect.ImmutableMultimap) UUID(java.util.UUID) Split(io.prestosql.metadata.Split) PlanFragment(io.prestosql.sql.planner.PlanFragment) QuerySnapshotManager(io.prestosql.snapshot.QuerySnapshotManager)

Example 12 with PartitioningScheme

use of io.prestosql.sql.planner.PartitioningScheme in project boostkit-bigdata by kunpengcompute.

the class OmniLocalQueryRunner method createDriversWithPlanOnly.

private void createDriversWithPlanOnly(Session session, Plan plan, OutputFactory outputFactory, TaskContext taskContext) {
    if (printPlan) {
        System.out.println(PlanPrinter.textLogicalPlan(plan.getRoot(), plan.getTypes(), metadata, plan.getStatsAndCosts(), session, 0, false));
    }
    SubPlan subplan = planFragmenter.createSubPlans(session, plan, true, WarningCollector.NOOP);
    if (!subplan.getChildren().isEmpty()) {
        throw new AssertionError("Expected subplan to have no children");
    }
    NodeInfo nodeInfo = new NodeInfo("test");
    FileSystemClientManager fileSystemClientManager = new FileSystemClientManager();
    SeedStoreManager seedStoreManager = new SeedStoreManager(fileSystemClientManager);
    StateStoreProvider stateStoreProvider = new LocalStateStoreProvider(seedStoreManager);
    LocalExecutionPlanner localExecutionPlanner = new LocalExecutionPlanner(metadata, new TypeAnalyzer(sqlParser, metadata), Optional.empty(), pageSourceManager, indexManager, nodePartitioningManager, pageSinkManager, null, expressionCompiler, pageFunctionCompiler, joinFilterFunctionCompiler, new IndexJoinLookupStats(), this.taskManagerConfig, spillerFactory, singleStreamSpillerFactory, partitioningSpillerFactory, new PagesIndex.TestingFactory(false), joinCompiler, new LookupJoinOperators(), new OrderingCompiler(), nodeInfo, stateStoreProvider, new StateStoreListenerManager(stateStoreProvider), new DynamicFilterCacheManager(), heuristicIndexerManager, cubeManager);
    OmniLocalExecutionPlanner omniLocalExecutionPlanner = new OmniLocalExecutionPlanner(localExecutionPlanner);
    ScheduledExecutorService taskNotificationExecutor = newScheduledThreadPool(10, threadsNamed("task-notification-%s"));
    OutputBuffer outputBuffer = new PartitionedOutputBuffer(new StateMachine<>("bufferState", taskNotificationExecutor, OPEN, TERMINAL_BUFFER_STATES), createInitialEmptyOutputBuffers(PARTITIONED).withBuffer(new OutputBuffers.OutputBufferId(0), 0).withNoMoreBufferIds(), new DataSize(1, MEGABYTE), () -> new SimpleLocalMemoryContext(newSimpleAggregatedMemoryContext(), "test"), taskNotificationExecutor);
    StageExecutionDescriptor stageExecutionDescriptor = subplan.getFragment().getStageExecutionDescriptor();
    omniLocalExecutionPlanner.plan(taskContext, subplan.getFragment().getRoot(), plan.getTypes(), new PartitioningScheme(Partitioning.create(FIXED_HASH_DISTRIBUTION, ImmutableList.of()), subplan.getFragment().getRoot().getOutputSymbols(), Optional.empty(), false, Optional.of(new int[] { 1 })), stageExecutionDescriptor, subplan.getFragment().getPartitionedSources(), outputBuffer, Optional.empty(), Optional.empty(), null);
}
Also used : StateStoreListenerManager(io.prestosql.statestore.listener.StateStoreListenerManager) PagesIndex(io.prestosql.operator.PagesIndex) LocalStateStoreProvider(io.prestosql.statestore.LocalStateStoreProvider) StateStoreProvider(io.prestosql.statestore.StateStoreProvider) OutputBuffer(io.prestosql.execution.buffer.OutputBuffer) PartitionedOutputBuffer(io.prestosql.execution.buffer.PartitionedOutputBuffer) LocalStateStoreProvider(io.prestosql.statestore.LocalStateStoreProvider) OutputBuffers.createInitialEmptyOutputBuffers(io.prestosql.execution.buffer.OutputBuffers.createInitialEmptyOutputBuffers) OutputBuffers(io.prestosql.execution.buffer.OutputBuffers) SeedStoreManager(io.prestosql.seedstore.SeedStoreManager) DataSize(io.airlift.units.DataSize) OrderingCompiler(io.prestosql.sql.gen.OrderingCompiler) LookupJoinOperators(io.prestosql.operator.LookupJoinOperators) DynamicFilterCacheManager(io.prestosql.dynamicfilter.DynamicFilterCacheManager) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) LocalExecutionPlanner(io.prestosql.sql.planner.LocalExecutionPlanner) PartitionedOutputBuffer(io.prestosql.execution.buffer.PartitionedOutputBuffer) SimpleLocalMemoryContext(io.prestosql.memory.context.SimpleLocalMemoryContext) IndexJoinLookupStats(io.prestosql.operator.index.IndexJoinLookupStats) StageExecutionDescriptor(io.prestosql.operator.StageExecutionDescriptor) PartitioningScheme(io.prestosql.sql.planner.PartitioningScheme) TypeAnalyzer(io.prestosql.sql.planner.TypeAnalyzer) FileSystemClientManager(io.prestosql.filesystem.FileSystemClientManager) NodeInfo(io.airlift.node.NodeInfo) SubPlan(io.prestosql.sql.planner.SubPlan)

Aggregations

PartitioningScheme (io.prestosql.sql.planner.PartitioningScheme)12 Symbol (io.prestosql.spi.plan.Symbol)8 PlanNode (io.prestosql.spi.plan.PlanNode)7 PlanNodeId (io.prestosql.spi.plan.PlanNodeId)6 PlanFragment (io.prestosql.sql.planner.PlanFragment)6 PlanFragmentId (io.prestosql.sql.planner.plan.PlanFragmentId)6 AggregationNode (io.prestosql.spi.plan.AggregationNode)4 ExchangeNode (io.prestosql.sql.planner.plan.ExchangeNode)4 Assignments (io.prestosql.spi.plan.Assignments)3 ProjectNode (io.prestosql.spi.plan.ProjectNode)3 TableScanNode (io.prestosql.spi.plan.TableScanNode)3 Type (io.prestosql.spi.type.Type)3 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 Session (io.prestosql.Session)2 ColumnHandle (io.prestosql.spi.connector.ColumnHandle)2 FilterNode (io.prestosql.spi.plan.FilterNode)2 LimitNode (io.prestosql.spi.plan.LimitNode)2