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);
}
}
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);
}
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;
}
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());
}
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);
}
Aggregations