Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-276

aggregation over empty rowset will cause "Failure while running fragment. < NoSuchElementException"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 0.4.0
    • None
    • None

    Description

      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]

      Attachments

        Issue Links

          Activity

            People

              jni Jinfeng Ni
              jni Jinfeng Ni
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: