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

Constant Folding performs partial evaluation on Coalesce operator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      EXPLAIN SELECT ctinyint, cdouble, cint, coalesce(ctinyint+10, (cdouble+log2(cint)), 0)
      FROM alltypesorc
      WHERE (ctinyint IS NULL) LIMIT 10;

      SELECT ctinyint, cdouble, cint, coalesce(ctinyint+10, (cdouble+log2(cint)), 0)
      FROM alltypesorc
      WHERE (ctinyint IS NULL) LIMIT 10;

      STAGE DEPENDENCIES:
      Stage-1 is a root stage
      Stage-0 depends on stages: Stage-1

      STAGE PLANS:
      Stage: Stage-1
      Map Reduce
      Map Operator Tree:
      TableScan
      alias: alltypesorc
      Statistics: Num rows: 165041 Data size: 2640659 Basic stats: COMPLETE Column stats: NONE
      Filter Operator
      predicate: ctinyint is null (type: boolean)
      Statistics: Num rows: 82520 Data size: 1320321 Basic stats: COMPLETE Column stats: NONE
      Select Operator
      expressions: null (type: void), cdouble (type: double), cint (type: int), COALESCE((null + 10),(cdouble + log2(cint)),0) (type: double)
      outputColumnNames: _col0, _col1, _col2, _col3
      Statistics: Num rows: 82520 Data size: 1320321 Basic stats: COMPLETE Column stats: NONE
      Limit
      Number of rows: 10
      Statistics: Num rows: 10 Data size: 160 Basic stats: COMPLETE Column stats: NONE
      File Output Operator
      compressed: false
      Statistics: Num rows: 10 Data size: 160 Basic stats: COMPLETE Column stats: NONE
      table:
      input format: org.apache.hadoop.mapred.TextInputFormat
      output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe

      Stage: Stage-0
      Fetch Operator
      limit: 10
      Processor Tree:
      ListSink

      As you see in the above plan, COALESCE((null + 10) can further be evaluated to null. Currently constant folding fails to perform this recursive folding.

      Attachments

        Activity

          People

            Unassigned Unassigned
            hsubramaniyan Hari Sankar Sivarama Subramaniyan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: