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

Incorrect result for query on interleaved index when vectorize=on #47029

Closed
mrigger opened this issue Apr 4, 2020 · 0 comments · Fixed by #47035
Closed

Incorrect result for query on interleaved index when vectorize=on #47029

mrigger opened this issue Apr 4, 2020 · 0 comments · Fixed by #47035
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.

Comments

@mrigger
Copy link

mrigger commented Apr 4, 2020

Consider the following test case:

SET vectorize=on;
CREATE TABLE t0(c0 INT);
CREATE TABLE t1(c0 INT);
INSERT INTO t0(c0) VALUES(0);
INSERT INTO t1(c0) VALUES(NULL);
CREATE INDEX ON t1(c0) INTERLEAVE IN PARENT t0(c0);
SELECT * FROM t0 WHERE t0.rowid > 0; -- expected: {}, actual: {0}

According to a SELECT rowid FROM t0, the value of rowid is NULL, which means that the predicate NOT(t0.rowid < 1) should evaluate to NULL and not fetch a row. However, it unexpectedly fetches a row. As expected, the following query (also) fetches a row:

SELECT * FROM t0 WHERE (t0.rowid > 0) IS NULL; -- {0}

Now surprisingly, without the SET vectorize=on flag, SELECT rowid FROM t0 fetches an integer (e.g., 543758368624279553). Based on this output, the first SELECT seems to be correct, but the second with the IS NULL predicate should not fetch a row. In each case, one of the query results seems to be incorrect.

I found this bug based on commit 5d33d44.

@mrigger mrigger added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Apr 4, 2020
@yuzefovich yuzefovich added this to Triage in BACKLOG, NO NEW ISSUES: SQL Execution via automation Apr 4, 2020
@yuzefovich yuzefovich moved this from Triage to 20.2.0 in BACKLOG, NO NEW ISSUES: SQL Execution Apr 4, 2020
@yuzefovich yuzefovich self-assigned this Apr 4, 2020
@craig craig bot closed this as completed in 8db0d8c Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants