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

Push case conditional from projections to dimension tables if possible

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.0-alpha-1
    • None
    • None

    Description

      noticed by gopalv: If there is a project which could be only evaluated after the join; but the condition references only a single column from a small dimension table; hive will end up evaluating the same thing over and over again...

      explain
      select  s_store_name, s_store_id,
              sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales,
              sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales,
              sum(case when (d_day_name='Tuesday') then ss_sales_price else  null end) tue_sales,
              sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales,
              sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales,
              sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales,
              sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales
       from date_dim, store_sales, store
       where d_date_sk = ss_sold_date_sk and
             s_store_sk = ss_store_sk and
             s_gmt_offset = -6 and
             d_year = 1998 
       group by s_store_name, s_store_id
       order by s_store_name, s_store_id,sun_sales,mon_sales,tue_sales,wed_sales,thu_sales,fri_sales,sat_sales
       limit 100;
      

      Attachments

        1. HIVE-20850.07.patch
          4.29 MB
          Zoltan Haindrich
        2. HIVE-20850.07.patch
          4.29 MB
          Zoltan Haindrich
        3. HIVE-20850.06.patch
          4.17 MB
          Zoltan Haindrich
        4. HIVE-20850.05.patch
          4.18 MB
          Zoltan Haindrich
        5. HIVE-20850.04.patch
          3.54 MB
          Zoltan Haindrich
        6. HIVE-20850.03.patch
          2.26 MB
          Zoltan Haindrich
        7. HIVE-20850.02.patch
          2.67 MB
          Zoltan Haindrich
        8. HIVE-20850.01.patch
          24 kB
          Zoltan Haindrich
        9. HIVE-20850.01.patch
          1.39 MB
          Zoltan Haindrich
        10. HIVE-20850.01.patch
          1.39 MB
          Zoltan Haindrich

        Activity

          People

            kgyrtkirk Zoltan Haindrich
            kgyrtkirk Zoltan Haindrich
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: