Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

out of bounds error in join query with filter on list column #2791

Closed
samansmink opened this issue Dec 13, 2021 · 1 comment · Fixed by #2799
Closed

out of bounds error in join query with filter on list column #2791

samansmink opened this issue Dec 13, 2021 · 1 comment · Fixed by #2799

Comments

@samansmink
Copy link
Contributor

Ran in v0.3.1 88aa81c in transient mode on an M1 Mac

CREATE TABLE test (id INTEGER, l VARCHAR[]);
INSERT INTO test SELECT i, case when (i/1000)%2=0 then [1::VARCHAR, 1::VARCHAR, 1::VARCHAR] else [2::VARCHAR, 2::VARCHAR] end FROM range(2000) tbl(i);
SELECT * FROM test AS t1 LEFT JOIN test AS t2 ON t1.id=t2.id WHERE t1.l!=t2.l or t1.id!=t2.id;

result: [1] 90267 bus error ./duckdb

expected result: empty result set

Running in debug build I get the message:
/src/common/row_operations/row_gather.cpp:54:19: runtime error: index 1024 out of bounds for type 'data_t *[1024]'

The problem seems to be that the GatherNestedVector function does not expect vectors with more than STANDARD_VECTOR_COUNT values, which happens in this query because of the filter on the list column

@zippond
Copy link
Contributor

zippond commented Dec 14, 2021

I get same error on Suse12.

duckdb/build/debug> ./duckdb

v0.3.2-dev556 3c1a9e3
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D CREATE TABLE test (id INTEGER, l VARCHAR[]);
D INSERT INTO test SELECT i, case when (i/1000)%2=0 then [1::VARCHAR, 1::VARCHAR, 1::VARCHAR] else [2::VARCHAR, 2::VARCHAR] end FROM range(2000) tbl(i);
D SELECT * FROM test AS t1 LEFT JOIN test AS t2 ON t1.id=t2.id WHERE t1.l!=t2.l or t1.id!=t2.id;
#####/git/duckdb/src/common/row_operations/row_gather.cpp:54:19: runtime error: index 1024 out of bounds for type 'data_t *[1024]'

For release version, the query never stop. Got coredump once use strace to attach.

Mytherin added a commit to Mytherin/duckdb that referenced this issue Dec 15, 2021
Mytherin added a commit that referenced this issue Dec 15, 2021
Fix #2791: allocate data and mask locations to correctly handle counts > vector_size in the row_gather
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants