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

colexec: fix evaluation of the IN expression with INT2 and INT4 types #121904

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

yuzefovich
Copy link
Member

This commit fixes a possible incorrect result of evaluation of the IN expression where the left side is INT2 or INT4 type and the right side has integers outside of the range of the left side's type. We do so by upcasting the "filter" row to INT8. Note that we already do the appropriate upcast in the comparison function, so the incorrect results could only be produced due to the "filter row" no longer being sorted in case a value overflows.

Fixes: #102864.

Release note (bug fix): CockroachDB could previously incorrectly evaluate IN expressions that had INT2 or INT4 type on the left side and values outside of the range of the left side on the right side. The bug has been present since at least 21.1 and is now fixed.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

This commit fixes a possible incorrect result of evaluation of the IN
expression where the left side is INT2 or INT4 type and the right side
has integers outside of the range of the left side's type. We do so by
upcasting the "filter" row to INT8. Note that we already do the
appropriate upcast in the comparison function, so the incorrect results
could only be produced due to the "filter row" no longer being sorted in
case a value overflows.

Release note (bug fix): CockroachDB could previously incorrectly
evaluate IN expressions that had INT2 or INT4 type on the left side and
values outside of the range of the left side on the right side. The bug
has been present since at least 21.1 and is now fixed.
@yuzefovich yuzefovich added backport-23.1.x Flags PRs that need to be backported to 23.1 backport-23.2.x Flags PRs that need to be backported to 23.2. backport-24.1.x Flags PRs that need to be backported to 24.1. labels Apr 7, 2024
@yuzefovich yuzefovich marked this pull request as ready for review April 8, 2024 16:11
@yuzefovich yuzefovich requested a review from a team as a code owner April 8, 2024 16:11
Copy link
Collaborator

@DrewKimball DrewKimball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: Thanks for the fix!

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @yuzefovich)

@yuzefovich
Copy link
Member Author

TFTR!

bors r+

Copy link

blathers-crl bot commented Apr 8, 2024

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 797c679 to blathers/backport-release-23.1-121904: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 23.1.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1 backport-23.2.x Flags PRs that need to be backported to 23.2. backport-24.1.x Flags PRs that need to be backported to 24.1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected results of IN with redundant values list
3 participants