[
https://issues.apache.org/jira/browse/HIVE-12082?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14951403#comment-14951403
]
Szehon Ho commented on HIVE-12082:
----------------------------------
Yea that's what I found too.
It looks like Hive is already good in terms of comparison operators (like '>'),
just broken from 'Greatest' and 'Least'
{noformat}
hive> SELECT 10Y > null
> FROM test
> ;
OK
NULL
hive> select greatest(null, 1) from test;
OK
1
{noformat}
I'll try to refactor the greatest/least operator class to use the same logics
as those, only difference is its a multi-way comparison.
> Null comparison for greatest and least operator
> -----------------------------------------------
>
> Key: HIVE-12082
> URL: https://issues.apache.org/jira/browse/HIVE-12082
> Project: Hive
> Issue Type: Bug
> Components: UDF
> Reporter: Szehon Ho
> Assignee: Szehon Ho
>
> In mysql comparisons if any of the entries are null, then the result is null.
> [https://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html|https://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html]
> and
> [https://dev.mysql.com/doc/refman/5.0/en/type-conversion.html|https://dev.mysql.com/doc/refman/5.0/en/type-conversion.html].
> This can be demonstrated by the following mysql query:
> {noformat}
> mysql> select greatest(1, null) from test;
> +-------------------+
> | greatest(1, null) |
> +-------------------+
> | NULL |
> +-------------------+
> 1 row in set (0.00 sec)
> mysql> select greatest(-1, null) from test;
> +--------------------+
> | greatest(-1, null) |
> +--------------------+
> | NULL |
> +--------------------+
> 1 row in set (0.00 sec)
> {noformat}
> This is in contrast to Hive, where null does not win in greatest, least over
> values.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)