You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by vo...@apache.org on 2018/07/02 06:23:40 UTC
[drill] 04/06: DRILL-6548: IllegalStateException: Unexpected EMIT
outcome received in buildSchema phase
This is an automated email from the ASF dual-hosted git repository.
volodymyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git
commit bf40c5ca84c7a3c783984369564dc151349114b9
Author: Sorabh Hamirwasia <sh...@maprtech.com>
AuthorDate: Thu Jun 28 22:20:32 2018 -0700
DRILL-6548: IllegalStateException: Unexpected EMIT outcome received in buildSchema phase
closes #1352
---
.../apache/drill/exec/physical/impl/TopN/TopNBatch.java | 1 +
.../exec/physical/impl/TopN/TestTopNEmitOutcome.java | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
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 a8c6804..4fc0d15 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 class TopNBatch extends AbstractRecordBatch<TopN> {
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 9358ff7..04d06aa 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 class TestTopNEmitOutcome extends BaseTestOpBatchEmitOutcome {
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);
+ }
}