Jinfeng Ni created DRILL-276:
--------------------------------
Summary: aggregation over empty rowset will cause "Failure while
running fragment. < NoSuchElementException"
Key: DRILL-276
URL: https://issues.apache.org/jira/browse/DRILL-276
Project: Apache Drill
Issue Type: Bug
Reporter: Jinfeng Ni
Priority: Minor
For the following query, the WHERE clause will produce 0 rows. If we apply the
count() function over the 0 result rows, drill will fail with error.
SELECT count(*) FROM "nation.parquet" where 1=0;
Here is the call stack when the NoSuchElementException is raised:
Seems that the SortRecordBatchBuilder does not have the code to handle empty
rowset yet, which leads to the error.
java.util.NoSuchElementException
java.util.HashMap$HashIterator.nextEntry(HashMap.java:929)
~[na:1.7.0_45]
java.util.HashMap$EntryIterator.next(HashMap.java:966) ~[na:1.7.0_45]
java.util.HashMap$EntryIterator.next(HashMap.java:964) ~[na:1.7.0_45]
com.google.common.collect.AbstractMapBasedMultimap$KeySet$1.next(AbstractMapBasedMultimap.java:946)
~[guava-14.0.1.jar:na]
org.apache.drill.exec.physical.impl.sort.SortRecordBatchBuilder.build(SortRecordBatchBuilder.java:94)
~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
org.apache.drill.exec.physical.impl.sort.SortBatch.next(SortBatch.java:138)
~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
org.apache.drill.exec.physical.impl.aggregate.AggBatch.next(AggBatch.java:85)
~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.next(ScreenCreator.java:77)
~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
org.apache.drill.exec.work.FragmentRunner.run(FragmentRunner.java:79)
~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[na:1.7.0_45]
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[na:1.7.0_45]
java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
--
This message was sent by Atlassian JIRA
(v6.1#6144)