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

CBO inserts a UDF cast for integer type promotion (only for negative numbers)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Patch Available
    • Critical
    • Resolution: Unresolved
    • 2.0.0
    • None
    • None
    • None

    Description

      When CBO is enabled, filters which compares tinyint, smallint columns with constant integer types will insert a UDFToInteger cast for the columns. When CBO is disabled, there is no such UDF. This behaviour breaks ORC predicate pushdown feature as ORC ignores UDFs in the filters.

      In the following examples column t is tinyint

      Explain for select count from orc_ppd where t < -127; (CBO OFF)
      Filter Operator [FIL_9]
                                 predicate:(t = 125) (type: boolean)
                                 Statistics:Num rows: 1050 Data size: 611757 Basic stats: COMPLETE Column stats: NONE
                                 TableScan [TS_0]
                                    alias:orc_ppd
                                    Statistics:Num rows: 2100 Data size: 1223514 Basic stats: COMPLETE Column stats: NONE
      
      Explain for select count from orc_ppd where t < -127; (CBO ON)
      Filter Operator [FIL_10]
                                 predicate:(UDFToInteger(t) < -127) (type: boolean)
                                 Statistics:Num rows: 700 Data size: 407838 Basic stats: COMPLETE Column stats: NONE
                                 TableScan [TS_0]
                                    alias:orc_ppd
                                    Statistics:Num rows: 2100 Data size: 1223514 Basic stats: COMPLETE Column stats: NONE
      

      CBO does not insert such cast for non-negative numbers

      Explain for select count from orc_ppd where t < 127; (CBO ON)
      Filter Operator [FIL_10]
                                 predicate:(t < 127) (type: boolean)
                                 Statistics:Num rows: 700 Data size: 407838 Basic stats: COMPLETE Column stats: NONE
                                 TableScan [TS_0]
                                    alias:orc_ppd
                                    Statistics:Num rows: 2100 Data size: 1223514 Basic stats: COMPLETE Column stats: NONE
      

      Attachments

        1. HIVE-11477.01.patch
          0.8 kB
          Pengcheng Xiong
        2. HIVE-11477.02.patch
          0.8 kB
          Pengcheng Xiong

        Activity

          People

            pxiong Pengcheng Xiong
            prasanth_j Prasanth Jayachandran
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: