Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-15160

Can't order by an unselected column

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0, 2.1.0, 2.2.0, 2.3.0
    • 3.0.0
    • None
    • None

    Description

      If a grouping key hasn't been selected, Hive complains. For comparison, Postgres does not.

      Example. Notice i_item_id is not selected:

      select  i_item_desc
             ,i_category
             ,i_class
             ,i_current_price
             ,sum(cs_ext_sales_price) as itemrevenue
             ,sum(cs_ext_sales_price)*100/sum(sum(cs_ext_sales_price)) over
                 (partition by i_class) as revenueratio
       from	catalog_sales
           ,item
           ,date_dim
       where cs_item_sk = i_item_sk
         and i_category in ('Jewelry', 'Sports', 'Books')
         and cs_sold_date_sk = d_date_sk
       and d_date between cast('2001-01-12' as date)
       				and (cast('2001-01-12' as date) + 30 days)
       group by i_item_id
               ,i_item_desc
               ,i_category
               ,i_class
               ,i_current_price
       order by i_category
               ,i_class
               ,i_item_id
               ,i_item_desc
               ,revenueratio
      limit 100;
      

      Attachments

        1. HIVE-15160.01.patch
          7 kB
          Pengcheng Xiong
        2. HIVE-15160.02.patch
          23 kB
          Pengcheng Xiong
        3. HIVE-15160.04.patch
          132 kB
          Pengcheng Xiong
        4. HIVE-15160.05.patch
          135 kB
          Pengcheng Xiong
        5. HIVE-15160.06.patch
          117 kB
          Pengcheng Xiong
        6. HIVE-15160.07.patch
          33 kB
          Pengcheng Xiong
        7. HIVE-15160.08.patch
          34 kB
          Pengcheng Xiong
        8. HIVE-15160.09.patch
          280 kB
          Pengcheng Xiong
        9. HIVE-15160.09.patch
          36 kB
          Pengcheng Xiong
        10. HIVE-15160.10.patch
          418 kB
          Pengcheng Xiong
        11. HIVE-15160.11.patch
          432 kB
          Pengcheng Xiong
        12. HIVE-15160.12.patch
          464 kB
          Pengcheng Xiong
        13. HIVE-15160.13.patch
          454 kB
          Pengcheng Xiong
        14. HIVE-15160.14.patch
          395 kB
          Pengcheng Xiong
        15. HIVE-15160.15.patch
          472 kB
          Pengcheng Xiong
        16. HIVE-15160.16.patch
          249 kB
          Pengcheng Xiong
        17. HIVE-15160.17.patch
          451 kB
          Pengcheng Xiong

        Issue Links

          Activity

            People

              pxiong Pengcheng Xiong
              pxiong Pengcheng Xiong
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: