Github user sachouche commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1237#discussion_r184575686
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unorderedreceiver/UnorderedReceiverBatch.java
 ---
    @@ -149,25 +149,32 @@ private RawFragmentBatch getNextBatch() throws 
IOException {
         }
       }
     
    +  private RawFragmentBatch getNextNotEmptyBatch() throws IOException {
    +    RawFragmentBatch batch;
    +    try {
    +      stats.startWait();
    +      batch = getNextBatch();
    +
    +      // skip over empty batches. we do this since these are basically 
control messages.
    +      while (batch != null && batch.getHeader().getDef().getRecordCount() 
== 0
    +          && (!first || batch.getHeader().getDef().getFieldCount() == 0)) {
    +        batch = getNextBatch();
    +      }
    +    } finally {
    +      stats.stopWait();
    +    }
    +    return batch;
    +  }
    +
       @Override
       public IterOutcome next() {
         batchLoader.resetRecordCount();
         stats.startProcessing();
    -    try{
    -      RawFragmentBatch batch;
    -      try {
    -        stats.startWait();
    -        batch = getNextBatch();
     
    -        // skip over empty batches. we do this since these are basically 
control messages.
    -        while (batch != null && 
batch.getHeader().getDef().getRecordCount() == 0
    -            && (!first || batch.getHeader().getDef().getFieldCount() == 
0)) {
    -          batch = getNextBatch();
    -        }
    -      } finally {
    -        stats.stopWait();
    -      }
    +    RawFragmentBatch batch = null;
    +    try {
     
    +      batch = getNextNotEmptyBatch();
           first = false;
     
           if (batch == null) {
    --- End diff --
    
    Sure.


---

Reply via email to