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

Fold case & when udfs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.14.0, 1.0.0, 1.1.0
    • 1.2.0
    • Logical Optimizer
    • None

    Description

      Constant folding for queries don't kick in for some automatically generated query patterns which look like this.

      hive> explain select count(1) from store_sales where (case ss_sold_date when '1998-01-01' then 1 else null end)=1;
      

      This should get rewritten by pushing the equality into the case branches.

      select count(1) from store_sales where (case ss_sold_date when '1998-01-01' then 1=1 else null=1 end);
      

      Ending up with a simplified filter condition, resolving itself as

      select count(1) from store_sales where ss_sold_date= '1998-01-01' ;
      

      Attachments

        1. HIVE-9644.patch
          21 kB
          Ashutosh Chauhan
        2. HIVE-9644.1.patch
          23 kB
          Ashutosh Chauhan
        3. HIVE-9644.2.patch
          45 kB
          Ashutosh Chauhan
        4. HIVE-9644.3.patch
          44 kB
          Ashutosh Chauhan

        Issue Links

          Activity

            People

              ashutoshc Ashutosh Chauhan
              gopalv Gopal Vijayaraghavan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: