Search in sources :

Example 6 with MinorFragmentEndpoint

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

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.getControlTunnel(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 7 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)

Example 8 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 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
   */
public static List<MinorFragmentEndpoint> getIndexOrderedEndpoints(List<DrillbitEndpoint> endpoints) {
    List<MinorFragmentEndpoint> destinations = Lists.newArrayList();
    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) DrillbitEndpoint(org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint) MinorFragmentEndpoint(org.apache.drill.exec.physical.MinorFragmentEndpoint)

Example 9 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 10 with MinorFragmentEndpoint

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

the class PartitionSenderRootExec method sendEmptyBatch.

public void sendEmptyBatch(boolean isLast) {
    BatchSchema schema = incoming.getSchema();
    if (schema == null) {
        // If the incoming batch has no schema (possible when there are no input records),
        // create an empty schema to avoid NPE.
        schema = BatchSchema.newBuilder().build();
    }
    FragmentHandle handle = context.getHandle();
    for (MinorFragmentEndpoint destination : popConfig.getDestinations()) {
        AccountingDataTunnel tunnel = context.getDataTunnel(destination.getEndpoint());
        FragmentWritableBatch writableBatch = FragmentWritableBatch.getEmptyBatchWithSchema(isLast, handle.getQueryId(), handle.getMajorFragmentId(), handle.getMinorFragmentId(), operator.getOppositeMajorFragmentId(), destination.getId(), schema);
        stats.startWait();
        try {
            tunnel.sendRecordBatch(writableBatch);
        } finally {
            stats.stopWait();
        }
    }
    stats.addLongStat(Metric.BATCHES_SENT, 1);
}
Also used : MinorFragmentEndpoint(org.apache.drill.exec.physical.MinorFragmentEndpoint) AccountingDataTunnel(org.apache.drill.exec.ops.AccountingDataTunnel) BatchSchema(org.apache.drill.exec.record.BatchSchema) FragmentWritableBatch(org.apache.drill.exec.record.FragmentWritableBatch) FragmentHandle(org.apache.drill.exec.proto.ExecProtos.FragmentHandle)

Aggregations

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