You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Incorrect result for IS NOT NULL predicate over UNION ALL query
To Reproduce
SELECT
a,
a IS NOT NULLFROM (
-- second column, even though it's not selected, is necessary to reproduce this bugSELECT'foo'AS a, 3AS b
UNION ALLSELECTNULLAS a, 4AS b
)
DF
+------+---------------+
| a | a IS NOT NULL |
+------+---------------+
| NULL | true 😱 |
| foo | true |
+------+---------------+
Expected behavior
NULL valued checked with IS NOT NULL should return false
trino> SELECT
-> a,
-> a IS NOT NULL
-> FROM (
-> SELECT 'foo' AS a, 3 AS b
-> UNION ALL
-> SELECT NULL AS a, 4 AS b
-> );
a | _col1
------+-------
foo | true
NULL | false
Additional context
No response
The text was updated successfully, but these errors were encountered:
initial plan for the Union already has the field marked as not-nullable, because the plan builder simply takes first input schema as the union schema (thus ignoring actual nullability). This alone maybe is corrected somewhere later, as the query without b projection does not reproduce the bug.
even if the plan is constructed correctly (by whatever means), the column pruning optimizer will do the same, replace union schema with the first input's schema (thus ignoring actual nullability).
Both bugs are being fixed in #14356.
The second led me to believe the idea that we can "reconstruct schema", while very convenient, is not solid, thus #14357.
Describe the bug
Incorrect result for IS NOT NULL predicate over UNION ALL query
To Reproduce
DF
Expected behavior
NULL
valued checked withIS NOT NULL
should returnfalse
Additional context
No response
The text was updated successfully, but these errors were encountered: