Search in sources :

Example 16 with MinorFragmentEndpoint

use of org.apache.drill.exec.physical.MinorFragmentEndpoint in project drill by axbaretto.

the class MergingRecordBatch method informSenders.

private void informSenders() {
    logger.info("Informing senders of request to terminate sending.");
    final FragmentHandle handlePrototype = FragmentHandle.newBuilder().setMajorFragmentId(config.getOppositeMajorFragmentId()).setQueryId(context.getHandle().getQueryId()).build();
    for (final MinorFragmentEndpoint providingEndpoint : config.getProvidingEndpoints()) {
        final FragmentHandle sender = FragmentHandle.newBuilder(handlePrototype).setMinorFragmentId(providingEndpoint.getId()).build();
        final FinishedReceiver finishedReceiver = FinishedReceiver.newBuilder().setReceiver(context.getHandle()).setSender(sender).build();
        context.getController().getTunnel(providingEndpoint.getEndpoint()).informReceiverFinished(new OutcomeListener(), finishedReceiver);
    }
}
Also used : MinorFragmentEndpoint(org.apache.drill.exec.physical.MinorFragmentEndpoint) FragmentHandle(org.apache.drill.exec.proto.ExecProtos.FragmentHandle) RpcOutcomeListener(org.apache.drill.exec.rpc.RpcOutcomeListener) FinishedReceiver(org.apache.drill.exec.proto.BitControl.FinishedReceiver)

Example 17 with MinorFragmentEndpoint

use of org.apache.drill.exec.physical.MinorFragmentEndpoint in project drill by axbaretto.

the class PartitionerTemplate method setup.

@Override
public final void setup(ExchangeFragmentContext context, RecordBatch incoming, HashPartitionSender popConfig, OperatorStats stats, OperatorContext oContext, int start, int end) throws SchemaChangeException {
    this.incoming = incoming;
    this.stats = stats;
    this.start = start;
    this.end = end;
    doSetup(context, incoming, null);
    // allocated.
    if (popConfig.getDestinations().size() > 1000) {
        // Always keep the recordCount as (2^x) - 1 to better utilize the memory allocation in ValueVectors
        outgoingRecordBatchSize = (DEFAULT_RECORD_BATCH_SIZE + 1) / 2 - 1;
    }
    int fieldId = 0;
    for (MinorFragmentEndpoint destination : popConfig.getDestinations()) {
        // create outgoingBatches only for subset of Destination Points
        if (fieldId >= start && fieldId < end) {
            logger.debug("start: {}, count: {}, fieldId: {}", start, end, fieldId);
            outgoingBatches.add(newOutgoingRecordBatch(stats, popConfig, context.getDataTunnel(destination.getEndpoint()), context, oContext.getAllocator(), destination.getId()));
        }
        fieldId++;
    }
    for (OutgoingRecordBatch outgoingRecordBatch : outgoingBatches) {
        outgoingRecordBatch.initializeBatch();
    }
    SelectionVectorMode svMode = incoming.getSchema().getSelectionVectorMode();
    switch(svMode) {
        case FOUR_BYTE:
            this.sv4 = incoming.getSelectionVector4();
            break;
        case TWO_BYTE:
            this.sv2 = incoming.getSelectionVector2();
            break;
        case NONE:
            break;
        default:
            throw new UnsupportedOperationException("Unknown selection vector mode: " + svMode.toString());
    }
}
Also used : MinorFragmentEndpoint(org.apache.drill.exec.physical.MinorFragmentEndpoint) MinorFragmentEndpoint(org.apache.drill.exec.physical.MinorFragmentEndpoint) SelectionVectorMode(org.apache.drill.exec.record.BatchSchema.SelectionVectorMode)

Example 18 with MinorFragmentEndpoint

use of org.apache.drill.exec.physical.MinorFragmentEndpoint in project drill by apache.

the class AbstractMuxExchange method getSender.

@Override
public Sender getSender(int minorFragmentId, PhysicalOperator child) {
    createSenderReceiverMapping();
    MinorFragmentEndpoint receiver = senderToReceiverMapping.get(minorFragmentId);
    if (receiver == null) {
        throw new IllegalStateException(String.format("Failed to find receiver for sender [%d]", minorFragmentId));
    }
    return new SingleSender(receiverMajorFragmentId, receiver.getId(), child, receiver.getEndpoint());
}
Also used : MinorFragmentEndpoint(org.apache.drill.exec.physical.MinorFragmentEndpoint)

Example 19 with MinorFragmentEndpoint

use of org.apache.drill.exec.physical.MinorFragmentEndpoint in project drill by apache.

the class PhysicalOperatorUtil method getIndexOrderedEndpoints.

/**
 * Helper method to create a list of {@code MinorFragmentEndpoint} instances from a
 * given endpoint assignment list.
 *
 * @param endpoints
 *          Assigned endpoint list. Index of each endpoint in list indicates
 *          the MinorFragmentId of the fragment that is assigned to the
 *          endpoint.
 * @return a list of (minor fragment id, endpoint) pairs in which the
 * minor fragment ID is reified as a member. Items are indexed by minor fragment
 * ID.
 */
public static List<MinorFragmentEndpoint> getIndexOrderedEndpoints(List<DrillbitEndpoint> endpoints) {
    List<MinorFragmentEndpoint> destinations = new ArrayList<>();
    int minorFragmentId = 0;
    for (DrillbitEndpoint endpoint : endpoints) {
        destinations.add(new MinorFragmentEndpoint(minorFragmentId, endpoint));
        minorFragmentId++;
    }
    return destinations;
}
Also used : MinorFragmentEndpoint(org.apache.drill.exec.physical.MinorFragmentEndpoint) DrillbitEndpoint(org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint) ArrayList(java.util.ArrayList) DrillbitEndpoint(org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint) MinorFragmentEndpoint(org.apache.drill.exec.physical.MinorFragmentEndpoint)

Example 20 with MinorFragmentEndpoint

use of org.apache.drill.exec.physical.MinorFragmentEndpoint in project drill by apache.

the class UnorderedDeMuxExchange method getReceiver.

@Override
public Receiver getReceiver(int minorFragmentId) {
    createSenderReceiverMapping();
    MinorFragmentEndpoint sender = receiverToSenderMapping.get(minorFragmentId);
    if (sender == null) {
        throw new IllegalStateException(String.format("Failed to find sender for receiver [%d]", minorFragmentId));
    }
    return new UnorderedReceiver(this.senderMajorFragmentId, Collections.singletonList(sender), false);
}
Also used : MinorFragmentEndpoint(org.apache.drill.exec.physical.MinorFragmentEndpoint)

Aggregations

MinorFragmentEndpoint (org.apache.drill.exec.physical.MinorFragmentEndpoint)21 DrillbitEndpoint (org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint)6 FragmentHandle (org.apache.drill.exec.proto.ExecProtos.FragmentHandle)6 FinishedReceiver (org.apache.drill.exec.proto.BitControl.FinishedReceiver)4 RpcOutcomeListener (org.apache.drill.exec.rpc.RpcOutcomeListener)4 SelectionVectorMode (org.apache.drill.exec.record.BatchSchema.SelectionVectorMode)3 IOException (java.io.IOException)2 List (java.util.List)2 AccountingDataTunnel (org.apache.drill.exec.ops.AccountingDataTunnel)2 FragmentContextImpl (org.apache.drill.exec.ops.FragmentContextImpl)2 HashPartitionSender (org.apache.drill.exec.physical.config.HashPartitionSender)2 PlanFragment (org.apache.drill.exec.proto.BitControl.PlanFragment)2 QueryContextInformation (org.apache.drill.exec.proto.BitControl.QueryContextInformation)2 MetricValue (org.apache.drill.exec.proto.UserBitShared.MetricValue)2 BatchSchema (org.apache.drill.exec.record.BatchSchema)2 FragmentWritableBatch (org.apache.drill.exec.record.FragmentWritableBatch)2 VectorAccessible (org.apache.drill.exec.record.VectorAccessible)2 OptionList (org.apache.drill.exec.server.options.OptionList)2 QueryWorkUnit (org.apache.drill.exec.work.QueryWorkUnit)2 ArrayList (java.util.ArrayList)1