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

UNION ALL on sub-queries with single column projection fails on GROUP BY

    XMLWordPrintableJSON

Details

    Description

      A UNION ALL on two sub-queries with only a single column projected, and GROUP BY on the whole query fails with an IndexOutOfBoundsException

      The following query fails to execute:

      SELECT c1
      FROM   ((SELECT ss_quantity           AS c1
              FROM   store_sales limit 1)
              UNION ALL 
              (SELECT ws_quantity              AS c2
              FROM   web_sales limit 1)
              ) foo 
      GROUP  BY c1;
      

      The following query also fails to execute:

      SELECT distinct(c)
      FROM   ((SELECT ss_quantity           AS c
              FROM   store_sales limit 1)
              UNION ALL 
              (SELECT ws_quantity              AS c
              FROM   web_sales limit 1)
              ) ;
      

      Error:
      Query failed: RemoteRpcException: Failure while running fragment., index: 0, length: 1 (expected: range(0, 0))

      LOG message indicates java.lang.IndexOutOfBoundsException

      The following query executes fine:

      SELECT c1
      FROM   ((SELECT ss_quantity           AS c1, ss_item_sk c3
              FROM   store_sales limit 1)
              UNION ALL 
              (SELECT ws_quantity              AS c2, ws_item_sk c4
              FROM   web_sales limit 1)
              ) foo 
      GROUP  BY c1;
      

      Attachments

        Issue Links

          Activity

            People

              seanhychu Sean Hsuan-Yi Chu
              agirish Abhishek Girish
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: