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

Zoltan Haindrich commented on HIVE-20881:
-----------------------------------------

Yes; but Calcite is already prepared to do that kinda of simplifications.
The caveat with translating NULLs to false is that beyond a not or an IS 
operator it may not do that even for FIL:
{code}
( (col1 and null) is null )
( NOT ( col1 and null) )
{code}
It will need some more logic to ensure that it doesn't get break the above 
cases - but I would like to wait for a ptest result and see how much difference 
it would make - since I think Calcite should also have been taken care of these 
cases.

> Constant propagation oversimplifies projections
> -----------------------------------------------
>
>                 Key: HIVE-20881
>                 URL: https://issues.apache.org/jira/browse/HIVE-20881
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Zoltan Haindrich
>            Assignee: Zoltan Haindrich
>            Priority: Major
>         Attachments: HIVE-20881.01.patch
>
>
> {code:java}
> create table cx2(bool1 boolean);
> insert into cx2 values (true),(false),(null);
> set hive.cbo.enable=true;
> select bool1 IS TRUE OR (cast(NULL as boolean) AND bool1 IS NOT TRUE AND 
> bool1 IS NOT FALSE) from cx2;
> +--------+
> |  _c0   |
> +--------+
> | true   |
> | false  |
> | NULL   |
> +--------+
> set hive.cbo.enable=false;
> select bool1 IS TRUE OR (cast(NULL as boolean) AND bool1 IS NOT TRUE AND 
> bool1 IS NOT FALSE) from cx2;
> +-------+
> |  _c0  |
> +-------+
> | true  |
> | NULL  |
> | NULL  |
> +-------+
> {code}
> from explain it seems the expression was simplified to: {{(_col0 is true or 
> null)}}



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

Reply via email to