Skip to content

duckdb: type the null-extended side of an outer join as nullable - #4723

Open
Yahiro025 wants to merge 1 commit into
sqlc-dev:mainfrom
Yahiro025:fix-core-outer-join-nullable
Open

Yahiro025 wants to merge 1 commit into
sqlc-dev:mainfrom
Yahiro025:fix-core-outer-join-nullable

Conversation

@Yahiro025

Copy link
Copy Markdown

The core analyzer flattened a join's relations into one scope without recording which side an outer join can fill with NULLs, so a NOT NULL column from the right of a LEFT JOIN (or the left of a RIGHT JOIN, or either side of a FULL JOIN) stayed non-nullable on DuckDB.

appendFromItem now copies those relations' columns with NotNull cleared. ClickHouse fills the unmatched side with defaults unless join_use_nulls is set, so its dialect gets an outer_join_defaults flag and keeps today's output (the LeftJoinDefaults case is unchanged). The SQLite analyze case picked up the now-nullable p.created.

Added an analyze_outer_join/duckdb case that fails on main; go test ./internal/endtoend -run TestReplay and the core tests pass.

Fixes #4711

The core analyzer flattened a join's relations without noting which side an
outer join can fill with NULLs, so their NOT NULL columns kept that
constraint. ClickHouse fills that side with defaults instead and is left as
it was.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

duckdb: columns from the right side of a LEFT JOIN are generated as non-nullable

1 participant