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

Replace with null when GenericUDFBaseCompare has a non-interpretable val

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.0
    • Fix Version/s: 4.0.0
    • Component/s: Parser

      Description

      The query

      create table ccn_table(key int, value string);
      set hive.cbo.enable=false;
      select * from ccn_table where key > '123a'  ;
      

      will scan all records(partitions) compared to older version,  as the plan tells: 

      STAGE PLANS:
       Stage: Stage-0
         Fetch Operator
           limit: -1
           Processor Tree:
             TableScan
               alias: ccn_table
               filterExpr: (key > '123a') (type: boolean)
               Statistics: Num rows: 2 Data size: 180 Basic stats: COMPLETE Column stats: COMPLETE
               GatherStats: false
               Filter Operator
                 isSamplingPred: false
                 predicate: (key > '123a') (type: boolean)
                 Statistics: Num rows: 1 Data size: 90 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
                   expressions: key (type: int), value (type: string)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 90 Basic stats: COMPLETE Column stats: COMPLETE
                   ListSink

      When the TypeCheckProcFactory#getXpathOrFuncExprNodeDesc validates the expr: key > '123a',  the operator(>) is not an equal operator(=),  so the factory returns key > '123a' as it is.  However all the subclass of GenericUDFBaseCompare(except GenericUDFOPEqualNS and GenericUDFOPNotEqualNS) would return null if either side of the function children is null,  so it's safe to return constant null when processing the expr `key > '123a'`.  This will  benifit some queries when the cbo is disabled.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dengzh Zhihua Deng
                Reporter:
                dengzh Zhihua Deng
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m