Skip to content

Nullable expression over non-null columns are planned as non-null-aware-joins #25024

Description

@AdamGS

Describe the bug

As seen in the query below, we currently only take column nullability into consideration when planning joins instead of full expression nullability, in cases where we join on an expression that might introduce nulls.

To Reproduce

CREATE TABLE outer_t(id VARCHAR NOT NULL) AS VALUES ('z');
CREATE TABLE inner_t(id VARCHAR NOT NULL) AS VALUES ('a');

SELECT id
FROM outer_t
WHERE (NULLIF(id, 'z') NOT IN (SELECT id FROM inner_t)) IS NULL;

Expected behavior

The query above currently returns no results, but should return a single row with the value z (verified with DuckDB).

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

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