hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gopal V (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-10716) Fold case/when udf for expression involving nulls in filter operator.
Date Wed, 27 May 2015 04:50:17 GMT

    [ https://issues.apache.org/jira/browse/HIVE-10716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14560403#comment-14560403
] 

Gopal V commented on HIVE-10716:
--------------------------------

The easiest fix to the problem seems to be an additional filter expr to produce an AND()
{code}
hive> explain select avg(ss_sold_date_sk) from store_sales where (case ss_sold_date when
'1998-01-02' then 1 else null end)=1;

     Map Operator Tree:
                TableScan
                  alias: store_sales
                  filterExpr: CASE (ss_sold_date) WHEN ('1998-01-02') THEN (true) ELSE (null)
END (type: int)
                  Statistics: Num rows: 2474913 Data size: 9899654 Basic stats: COMPLETE Column
stats: COMPLETE
{code}

vs

{code}
hive> explain select avg(ss_sold_date_sk) from store_sales where (case ss_sold_date when
'1998-01-02' then 1 else null end)=1 and ss_sold_time_Sk > 0;
            Map Operator Tree:
                TableScan
                  alias: store_sales
                  filterExpr: ((ss_sold_date = '1998-01-02') and (ss_sold_time_sk > 0))
(type: boolean)
                  Statistics: Num rows: 1237456 Data size: 9899654 Basic stats: COMPLETE Column
stats: COMPLETE
                  Filter Operator
                    predicate: (ss_sold_time_sk > 0) (type: boolean)
{code}

[~ashutoshc]: any idea why the extra filter helps in fixing the PPD case?

> 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)

Mime
View raw message