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

UNION ALL on Aggregates with GROUP BY returns incomplete results

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      The following query returns incomplete results:

      select x
      from
      (SELECT Sum(ss_ext_sales_price) x
      FROM  store_sales
      UNION ALL
      SELECT Sum(cs_ext_sales_price) x
      FROM catalog_sales) tmp
      GROUP BY x;
      
      Results from Drill:
      +------------+
      |     x      |
      +------------+
      | 3658019159.35 |
      +------------+
      1 row selected (3.474 seconds)
      
      Results from Postgres:
             x       
      ---------------
       5265207074.51
       3658019159.35
      (2 rows)
      

      Removing GROUP BY returns the right results:

      select x
      from
      (SELECT Sum(ss_ext_sales_price) x
      FROM  store_sales
      UNION ALL
      SELECT Sum(cs_ext_sales_price) x
      FROM catalog_sales) tmp;
      
      Results from Drill:
      +------------+
      |     x      |
      +------------+
      | 5265207074.51 |
      | 3658019159.35 |
      +------------+
      

      Attachments

        1. t1.parquet
          0.5 kB
          Victoria Markman
        2. t2.parquet
          0.5 kB
          Victoria Markman

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment