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