Skip to content

Incorrect result for IS NOT NULL predicate over UNION ALL query聽#14352

Description

@findepi

Describe the bug

Incorrect result for IS NOT NULL predicate over UNION ALL query

To Reproduce

SELECT
    a,
    a IS NOT NULL
FROM (
    -- second column, even though it's not selected, is necessary to reproduce this bug
    SELECT 'foo' AS a, 3 AS b
    UNION ALL
    SELECT NULL AS a, 4 AS 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions