Hari Sankar Sivarama Subramaniyan created HIVE-7650:
-------------------------------------------------------

             Summary: Constant Folding performs partial evaluation on Coalesce 
operator
                 Key: HIVE-7650
                 URL: https://issues.apache.org/jira/browse/HIVE-7650
             Project: Hive
          Issue Type: Bug
            Reporter: Hari Sankar Sivarama Subramaniyan


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.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to