sohami 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_r222897205
 
 

 ##########
 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:
   `aggregator` should ideally not be null here. This is just to avoid NPE and 
since returned AggOutcome is `RETURN_AND_RESET` with `OK_NEW_SCHEMA` then the 
next batch should be an empty batch with `EMIT` outcome.

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