[ https://issues.apache.org/jira/browse/HIVE-10716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14560400#comment-14560400 ]
Gopal V commented on HIVE-10716: -------------------------------- [~ashutoshc]: LGTM - +1 for the count(1) case, but it looks really odd that the {{TableScan::filterExpr}} is not getting folded for this. TableScan FilterExpr is populated before this folding happens, so it might just be an optimization ordering issue? {code} hive> explain select count(1) from store_sales where (case ss_sold_date when 'x' then 1 else null end)=1; STAGE PLANS: Stage: Stage-1 Tez Edges: Reducer 2 <- Map 1 (SIMPLE_EDGE) DagName: gopal_20150526214205_80c41d84-1694-47e9-ab24-144f8007b187:13 Vertices: Map 1 Map Operator Tree: TableScan alias: store_sales filterExpr: CASE (ss_sold_date) WHEN ('x') THEN (true) ELSE (null) END (type: int) Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE Filter Operator predicate: (ss_sold_date = 'x') (type: boolean) Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE Select Operator Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE Group By Operator aggregations: count(1) mode: hash outputColumnNames: _col0 Statistics: Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE Reduce Output Operator sort order: Statistics: Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE value expressions: _col0 (type: bigint) Execution mode: vectorized Reducer 2 Reduce Operator Tree: Group By Operator aggregations: count(VALUE._col0) {code} > Fold case/when udf for expression involving nulls in filter operator. > --------------------------------------------------------------------- > > Key: HIVE-10716 > URL: https://issues.apache.org/jira/browse/HIVE-10716 > Project: Hive > Issue Type: New Feature > Components: Logical Optimizer > Affects Versions: 1.3.0 > Reporter: Ashutosh Chauhan > Assignee: Ashutosh Chauhan > Attachments: HIVE-10716.patch > > > From HIVE-10636 comments, more folding is possible. -- This message was sent by Atlassian JIRA (v6.3.4#6332)