Search in sources :

Example 1 with IncomingBuffers

use of org.apache.drill.exec.work.batch.IncomingBuffers in project drill by apache.

the class MergingReceiverCreator method getBatch.

@Override
public MergingRecordBatch getBatch(FragmentContext context, MergingReceiverPOP receiver, List<RecordBatch> children) throws ExecutionSetupException, OutOfMemoryException {
    assert children == null || children.isEmpty();
    IncomingBuffers bufHolder = context.getBuffers();
    assert bufHolder != null : "IncomingBuffers must be defined for any place a receiver is declared.";
    RawBatchBuffer[] buffers = bufHolder.getBuffers(receiver.getOppositeMajorFragmentId());
    return new MergingRecordBatch(context, receiver, buffers);
}
Also used : IncomingBuffers(org.apache.drill.exec.work.batch.IncomingBuffers) MergingRecordBatch(org.apache.drill.exec.physical.impl.mergereceiver.MergingRecordBatch) RawBatchBuffer(org.apache.drill.exec.work.batch.RawBatchBuffer)

Example 2 with IncomingBuffers

use of org.apache.drill.exec.work.batch.IncomingBuffers in project drill by axbaretto.

the class MergingReceiverCreator method getBatch.

@SuppressWarnings("resource")
@Override
public MergingRecordBatch getBatch(ExecutorFragmentContext context, MergingReceiverPOP receiver, List<RecordBatch> children) throws ExecutionSetupException, OutOfMemoryException {
    assert children == null || children.isEmpty();
    IncomingBuffers bufHolder = context.getBuffers();
    assert bufHolder != null : "IncomingBuffers must be defined for any place a receiver is declared.";
    RawBatchBuffer[] buffers = bufHolder.getBuffers(receiver.getOppositeMajorFragmentId());
    return new MergingRecordBatch(context, receiver, buffers);
}
Also used : IncomingBuffers(org.apache.drill.exec.work.batch.IncomingBuffers) MergingRecordBatch(org.apache.drill.exec.physical.impl.mergereceiver.MergingRecordBatch) RawBatchBuffer(org.apache.drill.exec.work.batch.RawBatchBuffer)

Example 3 with IncomingBuffers

use of org.apache.drill.exec.work.batch.IncomingBuffers in project drill by apache.

the class UnorderedReceiverCreator method getBatch.

@Override
public UnorderedReceiverBatch getBatch(ExecutorFragmentContext context, UnorderedReceiver receiver, List<RecordBatch> children) throws ExecutionSetupException {
    assert children == null || children.isEmpty();
    IncomingBuffers bufHolder = context.getBuffers();
    assert bufHolder != null : "IncomingBuffers must be defined for any place a receiver is declared.";
    RawBatchBuffer[] buffers = bufHolder.getCollector(receiver.getOppositeMajorFragmentId()).getBuffers();
    assert buffers.length == 1;
    RawBatchBuffer buffer = buffers[0];
    return new UnorderedReceiverBatch(context, buffer, receiver);
}
Also used : IncomingBuffers(org.apache.drill.exec.work.batch.IncomingBuffers) RawBatchBuffer(org.apache.drill.exec.work.batch.RawBatchBuffer)

Example 4 with IncomingBuffers

use of org.apache.drill.exec.work.batch.IncomingBuffers in project drill by apache.

the class Foreman method setupRootFragment.

/**
   * Set up the root fragment (which will run locally), and submit it for execution.
   *
   * @param rootFragment
   * @param rootOperator
   * @throws ExecutionSetupException
   */
private void setupRootFragment(final PlanFragment rootFragment, final FragmentRoot rootOperator) throws ExecutionSetupException {
    @SuppressWarnings("resource") final FragmentContext rootContext = new FragmentContext(drillbitContext, rootFragment, queryContext, initiatingClient, drillbitContext.getFunctionImplementationRegistry());
    @SuppressWarnings("resource") final IncomingBuffers buffers = new IncomingBuffers(rootFragment, rootContext);
    rootContext.setBuffers(buffers);
    queryManager.addFragmentStatusTracker(rootFragment, true);
    final ControlTunnel tunnel = drillbitContext.getController().getTunnel(queryContext.getCurrentEndpoint());
    final FragmentExecutor rootRunner = new FragmentExecutor(rootContext, rootFragment, new FragmentStatusReporter(rootContext, tunnel), rootOperator);
    final RootFragmentManager fragmentManager = new RootFragmentManager(rootFragment.getHandle(), buffers, rootRunner);
    if (buffers.isDone()) {
        // if we don't have to wait for any incoming data, start the fragment runner.
        bee.addFragmentRunner(fragmentManager.getRunnable());
    } else {
        // if we do, record the fragment manager in the workBus.
        drillbitContext.getWorkBus().addFragmentManager(fragmentManager);
    }
}
Also used : ControlTunnel(org.apache.drill.exec.rpc.control.ControlTunnel) IncomingBuffers(org.apache.drill.exec.work.batch.IncomingBuffers) FragmentContext(org.apache.drill.exec.ops.FragmentContext) FragmentStatusReporter(org.apache.drill.exec.work.fragment.FragmentStatusReporter) RootFragmentManager(org.apache.drill.exec.work.fragment.RootFragmentManager) FragmentExecutor(org.apache.drill.exec.work.fragment.FragmentExecutor)

Example 5 with IncomingBuffers

use of org.apache.drill.exec.work.batch.IncomingBuffers in project drill by apache.

the class UnorderedReceiverCreator method getBatch.

@Override
public UnorderedReceiverBatch getBatch(FragmentContext context, UnorderedReceiver receiver, List<RecordBatch> children) throws ExecutionSetupException {
    assert children == null || children.isEmpty();
    IncomingBuffers bufHolder = context.getBuffers();
    assert bufHolder != null : "IncomingBuffers must be defined for any place a receiver is declared.";
    RawBatchBuffer[] buffers = bufHolder.getBuffers(receiver.getOppositeMajorFragmentId());
    assert buffers.length == 1;
    RawBatchBuffer buffer = buffers[0];
    return new UnorderedReceiverBatch(context, buffer, receiver);
}
Also used : IncomingBuffers(org.apache.drill.exec.work.batch.IncomingBuffers) RawBatchBuffer(org.apache.drill.exec.work.batch.RawBatchBuffer)

Aggregations

IncomingBuffers (org.apache.drill.exec.work.batch.IncomingBuffers)7 RawBatchBuffer (org.apache.drill.exec.work.batch.RawBatchBuffer)6 MergingRecordBatch (org.apache.drill.exec.physical.impl.mergereceiver.MergingRecordBatch)3 FragmentContext (org.apache.drill.exec.ops.FragmentContext)1 ControlTunnel (org.apache.drill.exec.rpc.control.ControlTunnel)1 FragmentExecutor (org.apache.drill.exec.work.fragment.FragmentExecutor)1 FragmentStatusReporter (org.apache.drill.exec.work.fragment.FragmentStatusReporter)1 RootFragmentManager (org.apache.drill.exec.work.fragment.RootFragmentManager)1