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_r222897211
##########
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();
}
// Release external sort batches after EMIT is seen
ExternalSortBatch.releaseBatches(incoming);
- return lastKnownOutcome;
+ lastKnownOutcome = EMIT;
+ return returnOutcome;
case RETURN_OUTCOME:
// In case of complex writer expression, vectors would be added to
batch run-time.
// We have to re-build the schema.
if (complexWriters != null) {
container.buildSchema(SelectionVectorMode.NONE);
}
- if (lastKnownOutcome == IterOutcome.NONE ) {
+ if (returnOutcome == IterOutcome.NONE ) {
// we will set the 'done' flag in the next call to innerNext and use
the lastKnownOutcome
// to determine whether we should set the flag or not.
// This is so that if someone calls getRecordCount in between calls
to innerNext, we will
// return the correct record count (if the done flag is set, we will
return 0).
if (first) {
first = false;
+ lastKnownOutcome = NONE;
return OK_NEW_SCHEMA;
} else {
+ lastKnownOutcome = NONE;
Review comment:
done
----------------------------------------------------------------
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