-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
PR submittedA pull request was submitted to fix the issueA pull request was submitted to fix the issue
Description
What happens?
On duckdb main
and duckdb v0.10.1
, joining arrays result in wrong join results if there are leading null
values in the table.
To Reproduce
If you join a table using an array on a key without null values in the table, the join result is correct:
CREATE TABLE test_array (c1 int[3]);
INSERT INTO test_array values (array[1, 2, 3]), (array[4, 5, 6]), (array[7, 8, 9]);
SELECT * FROM test_array JOIN test_array AS t2 ON t2.c1 = test_array.c1;
┌────────────┬────────────┐
│ c1 │ c1 │
│ integer[3] │ integer[3] │
├────────────┼────────────┤
│ [1, 2, 3] │ [1, 2, 3] │
│ [4, 5, 6] │ [4, 5, 6] │
│ [7, 8, 9] │ [7, 8, 9] │
└────────────┴────────────┘
If there are null values in front of the normal arrays, the join results in a wrong result on duckdb 10.1 and triggers the address sanitizer when running duckdb main in debug mode:
CREATE TABLE test_array (c1 int[3]);
INSERT INTO test_array values (null), (array[1, 2, 3]), (array[4, 5, 6]), (array[7, 8, 9]);
SELECT * FROM test_array JOIN test_array AS t2 ON t2.c1 = test_array.c1;
┌────────────┬────────────┐
│ c1 │ c1 │
│ integer[3] │ integer[3] │
├────────────┼────────────┤
│ [1, 2, 3] │ [1, 2, 3] │
│ [4, 5, 6] │ [4, 5, 6] │
└────────────┴────────────┘ (last row missing)
The debugger points to
hdata[ridx] = CombineHashScalar(hdata[ridx], chdata[offset + j]); |
If you need more details, let me know, thanks in advance for having a look!
OS:
iOS
DuckDB Version:
0.10.1
DuckDB Client:
CLI
Full Name:
Paul Gross
Affiliation:
CWI
Have you tried this on the latest nightly build?
I have tested with a nightly build
Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
- Yes, I have
Metadata
Metadata
Assignees
Labels
PR submittedA pull request was submitted to fix the issueA pull request was submitted to fix the issue