asfgit closed pull request #1352: DRILL-6548: IllegalStateException: Unexpected EMIT outcome received i… URL: https://github.com/apache/drill/pull/1352
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java index a8c6804fd8..4fc0d1596a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java @@ -174,6 +174,7 @@ public void buildSchema() throws SchemaChangeException { return; case NONE: state = BatchState.DONE; + return; case EMIT: throw new IllegalStateException("Unexpected EMIT outcome received in buildSchema phase"); default: diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TopN/TestTopNEmitOutcome.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TopN/TestTopNEmitOutcome.java index 9358ff7457..04d06aacd5 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TopN/TestTopNEmitOutcome.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TopN/TestTopNEmitOutcome.java @@ -638,4 +638,20 @@ public void testRegularTopNWithEmptyDataSet() { assertTrue(topNBatch.next() == RecordBatch.IterOutcome.OK_NEW_SCHEMA); assertTrue(topNBatch.next() == RecordBatch.IterOutcome.NONE); } + + @Test + public void testRegularTopNWithEmptyDataSetAndNoneOutcome() { + inputContainer.add(emptyInputRowSet.container()); + inputOutcomes.add(RecordBatch.IterOutcome.NONE); + + final MockRecordBatch mockInputBatch = new MockRecordBatch(operatorFixture.getFragmentContext(), opContext, + inputContainer, inputOutcomes, emptyInputRowSet.container().getSchema()); + + final TopN topNConfig = new TopN(null, + Lists.newArrayList(ordering("id_left", RelFieldCollation.Direction.DESCENDING, + RelFieldCollation.NullDirection.FIRST)), false, 4); + final TopNBatch topNBatch = new TopNBatch(topNConfig, operatorFixture.getFragmentContext(), mockInputBatch); + + assertTrue(topNBatch.next() == RecordBatch.IterOutcome.NONE); + } } ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services