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

Constant propagation oversimplifies projections

    XMLWordPrintableJSON

Details

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

    Description

      create table cx2(bool1 boolean);
      insert into cx2 values (true),(false),(null);
      
      set hive.cbo.enable=true;
      select bool1 IS TRUE OR (cast(NULL as boolean) AND bool1 IS NOT TRUE AND bool1 IS NOT FALSE) from cx2;
      
      +--------+
      |  _c0   |
      +--------+
      | true   |
      | false  |
      | NULL   |
      +--------+
      
      
      set hive.cbo.enable=false;
      select bool1 IS TRUE OR (cast(NULL as boolean) AND bool1 IS NOT TRUE AND bool1 IS NOT FALSE) from cx2;
      
      +-------+
      |  _c0  |
      +-------+
      | true  |
      | NULL  |
      | NULL  |
      +-------+
      
      

      from explain it seems the expression was simplified to: (_col0 is true or null)

      Attachments

        1. HIVE-20881.01.patch
          4 kB
          Zoltan Haindrich

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: