Skip to content

Conversation

Tmonster
Copy link
Owner

As the title says.

fixes https://github.com/duckdblabs/duckdb-internal/issues/3063

Normally when a comparison takes place in a where clause, a validity mask is not passed for the resulting vector. Instead, NULL if one of the left or right vectors has a null value, then the condition is not "matched". However, this only works for non-nested column types (i.e int, string, uuid, etc.) where the validity mask is valid for the column value. For nested types, however, there can be a valid list with a NULL value. These cases are missed during the normal null checking, so a "match" is produced. This caused logically inconsistent results in queries like the following

broken behaviour

select 1 from VALUES ([NULL, 6], [5, 6])  t(a, b) where a<>b;
----
1

select a<>b from VALUES ([NULL, 6], [5, 6])  t(a, b);
----
NULL


select a<>b from VALUES ([NULL, 6], [5, 6])  t(a, b) where NULL;
----

The fix is to pass a validity mask to the expression executor in the physical filter. This validity mask is only used for filters on nested types, so hopefully it should regress filter functions too much.

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.

1 participant