You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Alessandro Solimando (Jira)" <ji...@apache.org> on 2022/11/13 18:44:00 UTC

[jira] [Updated] (HIVE-26733) HiveRelMdPredicates::getPredicate(Project) should return IS_NULL for CAST(NULL)

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

Alessandro Solimando updated HIVE-26733:
----------------------------------------
    Description: 
Given a _CAST(NULL as $type)_ as i-th project expression, the method returns _(=($i, CAST(null:NULL):$type)_ instead of _IS_NULL($i)_ as in the case of a _NULL_ literal project expression.

This is because _RexLiteral::isNullLiteral_ is used [here|https://github.com/apache/hive/blob/a6c0229f910972e84ba558e728532ffc245cc10d/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdPredicates.java#L153], while in similar cases, it's often convenient to use {_}RexUtil::isNullLiteral(RexNode, boolean allowCast){_}.

  was:
Given a _CAST(NULL as $type)_ as i-th project expression, the method returns _(=($i, CAST(null:NULL):$type)_ instead of _IS_NULL($i)_ as in the case of a _NULL_ literal project expression.

This is because _RexLiteral::isNullLiteral_ is used [here|https://github.com/apache/hive/blob/a6c0229f910972e84ba558e728532ffc245cc10d/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdPredicates.java#L153], while in similar places, it's often convenient to use {_}RexUtil::isNullLiteral(RexNode, boolean allowCast){_}.


> HiveRelMdPredicates::getPredicate(Project) should return IS_NULL for CAST(NULL)
> -------------------------------------------------------------------------------
>
>                 Key: HIVE-26733
>                 URL: https://issues.apache.org/jira/browse/HIVE-26733
>             Project: Hive
>          Issue Type: Bug
>          Components: CBO
>    Affects Versions: 4.0.0-alpha-1
>            Reporter: Alessandro Solimando
>            Assignee: Alessandro Solimando
>            Priority: Major
>
> Given a _CAST(NULL as $type)_ as i-th project expression, the method returns _(=($i, CAST(null:NULL):$type)_ instead of _IS_NULL($i)_ as in the case of a _NULL_ literal project expression.
> This is because _RexLiteral::isNullLiteral_ is used [here|https://github.com/apache/hive/blob/a6c0229f910972e84ba558e728532ffc245cc10d/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdPredicates.java#L153], while in similar cases, it's often convenient to use {_}RexUtil::isNullLiteral(RexNode, boolean allowCast){_}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)