[
https://issues.apache.org/jira/browse/HIVE-28926?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dmitriy Fingerman updated HIVE-28926:
-------------------------------------
Labels: correctness (was: )
> 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
> Labels: correctness
>
> {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)