You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Gopal V (JIRA)" <ji...@apache.org> on 2018/09/14 03:33:00 UTC

[jira] [Updated] (HIVE-20557) Constant Folding: null > (expr) is not constant folded to NULL

     [ https://issues.apache.org/jira/browse/HIVE-20557?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gopal V updated HIVE-20557:
---------------------------
    Affects Version/s: 4.0.0
                       3.1.0

> Constant Folding: null > (expr) is not constant folded to NULL
> --------------------------------------------------------------
>
>                 Key: HIVE-20557
>                 URL: https://issues.apache.org/jira/browse/HIVE-20557
>             Project: Hive
>          Issue Type: Improvement
>          Components: CBO
>    Affects Versions: 3.1.0, 4.0.0
>            Reporter: Gopal V
>            Priority: Major
>
> {code}
> create temporary table foo(col1 int, col2 int, col3 int, col5 int, col9 int) stored as orc;
> explain select count(1) from foo where 
> CASE WHEN (col5 is not null) THEN (((col1 / col5) > (col9 / col3))) ELSE ((null > (col9 / col3))) END;
> explain select count(1), max((col9/col3) > null) from foo where 
> CASE WHEN (col5 is not null) THEN (((col1 / col5) > (col9 / col3))) ELSE (((col9 / col3) > null)) END;
> {code}
> There's no sane way to write this query, but this is actually generated by CBO for an expression which looks like 
> {code}
> case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else null end
>            > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else null end
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)