-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
release-20.2: colfetcher: fix NULL checks during unique index decoding #68238
release-20.2: colfetcher: fix NULL checks during unique index decoding #68238
Conversation
Thanks for opening a backport. Please check the backport criteria before merging:
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
Add a brief release justification to the body of your PR to justify this backport. Some other things to consider:
|
# Regression test for #66706. Ensure that cfetcher can correctly determine when | ||
# consecutive KVs in a unique secondary index belong to the same row. | ||
statement ok | ||
SET vectorize = experimental_always |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this because I believe it is necessary in 20.2 to ensure that the queries below use the vectorized engine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r1.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @mgartner)
pkg/sql/logictest/testdata/logic_test/vectorize, line 1298 at r1 (raw file):
Previously, mgartner (Marcus Gartner) wrote…
I added this because I believe it is necessary in 20.2 to ensure that the queries below use the vectorized engine.
I think on 20.2 CREATE TABLE
and INSERT
might not go through vectorized (weren't supported yet), so we want to have this right before the SELECT
query, and right after we want RESET vectorize;
.
a0e2248
to
5189ea2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @yuzefovich)
pkg/sql/logictest/testdata/logic_test/vectorize, line 1298 at r1 (raw file):
Previously, yuzefovich (Yahor Yuzefovich) wrote…
I think on 20.2
CREATE TABLE
andINSERT
might not go through vectorized (weren't supported yet), so we want to have this right before theSELECT
query, and right after we wantRESET vectorize;
.
Thanks! Done.
`colfetcher` must detect `NULL` values in unique secondary index keys on tables with multiple column families in order to determine whether consecutive KVs belongs to the same row or different rows. Previously, only the columns in the key that were needed by the query were decoded and checked for `NULL`. This caused incorrect query results when `NULL` column values were not detected because those columns were not needed. This commit fixes the issue by checking all columns for `NULL` when decoding unique secondary index keys on tables with multiple column families. Fixes cockroachdb#66706 Release note (bug fix): A bug has been fix that caused incorrect query results when querying tables with multiple column families and unique secondary indexes. The bug only occurred if 1) vectorized execution was enabled for the query, 2) the query scanned a unique secondary index that contained columns from more than one column family, and 3) rows fetched by the query contained NULL values for some of the indexed columns. This bug was present since version 20.1.
5189ea2
to
0f3f45a
Compare
Backport 1/1 commits from #68071.
/cc @cockroachdb/release
Release justification: This backport fixes a correctness bug in the
vectorized execution engine. See the release note for details.
colfetcher
must detectNULL
values in unique secondary index keys ontables with multiple column families in order to determine whether
consecutive KVs belongs to the same row or different rows. Previously,
only the columns in the key that were needed by the query were decoded
and checked for
NULL
. This caused incorrect query results whenNULL
column values were not detected because those columns were not needed.
This commit fixes the issue by checking all columns for
NULL
whendecoding unique secondary index keys on tables with multiple column
families.
Fixes #66706
Release note (bug fix): A bug has been fix that caused incorrect query
results when querying tables with multiple column families and unique
secondary indexes. The bug only occurred if 1) vectorized execution was
enabled for the query, 2) the query scanned a unique secondary index
that contained columns from more than one column family, and 3) rows
fetched by the query contained NULL values for some of the indexed
columns. This bug was present since version 20.1.