Package com.facebook.presto

Examples of com.facebook.presto.TaskSource


        Driver driver = driverFactory.createDriver(driverContext);

        if (partitionedSplit != null) {
            // TableScanOperator requires partitioned split to be added before task is started
            driver.updateSource(new TaskSource(partitionedSourceId, ImmutableSet.of(partitionedSplit), true));
        }

        // record driver so other threads add unpartitioned sources can see the driver
        // NOTE: this MUST be done before reading unpartitionedSources, so we see a consistent view of the unpartitioned sources
        drivers.add(new WeakReference<>(driver));
View Full Code Here


        ImmutableList.Builder<TaskSource> sources = ImmutableList.builder();
        for (PlanNodeId planNodeId : planFragment.getSourceIds()) {
            Set<ScheduledSplit> splits = pendingSplits.get(planNodeId);
            boolean noMoreSplits = this.noMoreSplits.contains(planNodeId);
            if (!splits.isEmpty() || noMoreSplits) {
                sources.add(new TaskSource(planNodeId, splits, noMoreSplits));
            }
        }
        return sources.build();
    }
View Full Code Here

                    Thread.currentThread().interrupt();
                    throw Throwables.propagate(e);
                }
            }

            sources.add(new TaskSource(tableScan.getId(), scheduledSplits.build(), true));
        }

        // create drivers
        List<Driver> drivers = new ArrayList<>();
        Map<PlanNodeId, Driver> driversBySource = new HashMap<>();
View Full Code Here

            return;
        }

        // create new source
        Set<ScheduledSplit> newSplits;
        TaskSource currentSource = sources.get(sourceId);
        if (currentSource == null) {
            newSplits = source.getSplits();
        }
        else {
            // merge the current source and the specified source
            TaskSource newSource = currentSource.update(source);

            // if this is not a new source, just return
            if (newSource == currentSource) {
                return;
            }

            // find the new splits to add
            newSplits = Sets.difference(newSource.getSplits(), currentSource.getSplits());
            sources.put(sourceId, newSource);
        }

        // add new splits
        for (ScheduledSplit newSplit : newSplits) {
View Full Code Here

        ImmutableList.Builder<TaskSource> sources = ImmutableList.builder();
        for (PlanNodeId planNodeId : planFragment.getSourceIds()) {
            Set<ScheduledSplit> splits = pendingSplits.get(planNodeId);
            boolean noMoreSplits = this.noMoreSplits.contains(planNodeId);
            if (!splits.isEmpty() || noMoreSplits) {
                sources.add(new TaskSource(planNodeId, splits, noMoreSplits));
            }
        }
        return sources.build();
    }
View Full Code Here

        assertEquals(taskInfo.getState(), TaskState.RUNNING);

        taskInfo = sqlTaskManager.updateTask(session,
                taskId,
                testFragment,
                ImmutableList.<TaskSource>of(new TaskSource(tableScanNodeId, ImmutableSet.<ScheduledSplit>of(), true)),
                INITIAL_EMPTY_OUTPUT_BUFFERS.withNoMoreBufferIds());
        assertEquals(taskInfo.getState(), TaskState.FINISHED);

        taskInfo = sqlTaskManager.getTaskInfo(taskInfo.getTaskId(), false);
        assertEquals(taskInfo.getState(), TaskState.FINISHED);
View Full Code Here

            throws Exception
    {
        TaskInfo taskInfo = sqlTaskManager.updateTask(session,
                taskId,
                testFragment,
                ImmutableList.<TaskSource>of(new TaskSource(tableScanNodeId, ImmutableSet.of(new ScheduledSplit(0, split)), true)),
                INITIAL_EMPTY_OUTPUT_BUFFERS.withBuffer("out", new UnpartitionedPagePartitionFunction()).withNoMoreBufferIds());
        assertEquals(taskInfo.getState(), TaskState.RUNNING);

        taskInfo = sqlTaskManager.getTaskInfo(taskInfo.getTaskId(), false);
        assertEquals(taskInfo.getState(), TaskState.RUNNING);
View Full Code Here

            throws Exception
    {
        TaskInfo taskInfo = sqlTaskManager.updateTask(session,
                taskId,
                testFragment,
                ImmutableList.<TaskSource>of(new TaskSource(tableScanNodeId, ImmutableSet.of(new ScheduledSplit(0, split)), true)),
                INITIAL_EMPTY_OUTPUT_BUFFERS.withBuffer("out", new UnpartitionedPagePartitionFunction()).withNoMoreBufferIds());
        assertEquals(taskInfo.getState(), TaskState.RUNNING);

        taskInfo = sqlTaskManager.getTaskInfo(taskInfo.getTaskId(), false);
        assertEquals(taskInfo.getState(), TaskState.RUNNING);
View Full Code Here

        assertFalse(bufferResult.isBufferClosed());

        bufferResult = taskExecution.getResults("out", 0, new DataSize(1, Unit.MEGABYTE), new Duration(0, TimeUnit.MILLISECONDS));
        assertFalse(bufferResult.isBufferClosed());

        taskExecution.addSources(ImmutableList.of(new TaskSource(tableScanNodeId, ImmutableSet.<ScheduledSplit>of(), true)));
        assertEquals(taskExecution.getTaskInfo(false).getState(), TaskState.FINISHED);

        // buffer will be closed by cancel event (wait for 500 MS for event to fire)
        bufferResult = taskExecution.getResults("out", 0, new DataSize(1, Unit.MEGABYTE), new Duration(500, TimeUnit.MILLISECONDS));
        assertTrue(bufferResult.isBufferClosed());
View Full Code Here

                    Thread.currentThread().interrupt();
                    throw Throwables.propagate(e);
                }
            }

            sources.add(new TaskSource(tableScan.getId(), scheduledSplits.build(), true));
        }

        // create drivers
        List<Driver> drivers = new ArrayList<>();
        Map<PlanNodeId, Driver> driversBySource = new HashMap<>();
View Full Code Here

TOP

Related Classes of com.facebook.presto.TaskSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.