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

Stamatis Zampetakis commented on HIVE-28926:
--------------------------------------------

I bumped into this while I was doing some tests for Calcite upgrade 
(HIVE-27102).

The problem affects current master and can be reproduced in commit 
[28abf17424e97112d75947f1d7a2f043b3961fa4|https://github.com/apache/hive/commit/28abf17424e97112d75947f1d7a2f043b3961fa4]

> Wrong results when comparing STRUCT/ROW with nulls
> --------------------------------------------------
>
>                 Key: HIVE-28926
>                 URL: https://issues.apache.org/jira/browse/HIVE-28926
>             Project: Hive
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 4.0.1
>            Reporter: Stamatis Zampetakis
>            Assignee: Stamatis Zampetakis
>            Priority: Major
>
> {code:sql}
> CREATE TABLE t (id int, cstring STRING);
> INSERT INTO t VALUES(1,'A'), (2,'X'), (3,null);
> SELECT id, (t.cstring, 'B') = ('A', 'B') FROM t;
> SELECT id, STRUCT(t.cstring, 'B') = STRUCT('A', 'B') FROM t;
> {code}
> +Expected+
> |1|true|
> |2|false|
> |3|null|
> +Actual+
> |1|true|
> |2|false|
> |3|false|
> The problem can be seen in row 3 when comparing the following STRUCT/ROW 
> types.
> {noformat}
> (null, 'B') = ('A', 'B')
> {noformat}
> The result is *false* but it should be *null* cause equality between null and 
> 'A' is not defined.
> I checked with Postgres and the SQL standard and it seems that returning null 
> is the correct behavior.



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

Reply via email to