Ben-Zvi commented on a change in pull request #1490: DRILL-6766: Lateral Unnest 
query : IllegalStateException - rowId in right batch of lateral is smaller than 
rowId in left batch being processed
URL: https://github.com/apache/drill/pull/1490#discussion_r222876377
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatch.java
 ##########
 @@ -298,59 +305,63 @@ public IterOutcome innerNext() {
           // If outcome is NONE then we send the special batch in the first 
iteration and the NONE
           // outcome in the next iteration. If outcome is EMIT, we can send 
the special
           // batch and the EMIT outcome at the same time.
-
-          IterOutcome finalOutcome =  getFinalOutcome();
-          return finalOutcome;
+          return getFinalOutcome();
         }
         firstBatchForDataSet = true;
         firstBatchForSchema = false;
         if(first) {
           first = false;
         }
-        if(lastKnownOutcome == OK_NEW_SCHEMA) {
-          sendEmit = true;
+        if(returnOutcome == OK_NEW_SCHEMA) {
+          sendEmit = (aggregator == null) || 
aggregator.previousBatchProcessed();
 
 Review comment:
   (1) Can be helpful to add a short comment here.
   (2) When the `aggregator` is null -- is this the case of doing *DISTINCT* ?  
If so, could the previous batch still be partly unprocessed ?
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to