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

Reply via email to