Search in sources :

Example 21 with MinorFragmentEndpoint

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

the class PartitionSenderRootExec method sendEmptyBatch.

private 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)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