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 CASE operator a bit #67757

Merged
merged 1 commit into from
Jul 19, 2021
Merged

Conversation

yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Jul 19, 2021

Whenever we're updating the length on the batch containing bytes-like
vectors, we are updating those vectors to have non-decreasing offsets.
In case the batch has a selection vector set, we're using the largest
index in the selection to update the offsets. This logic relies on the
assumption that the selection vector is set on the batch before
setting the length which wasn't the case in a couple of places.

In particular, the recent refactor of the case operator added the
support of bytes-like types as the output of the case operator, but the
existing code was setting the length on the batch first. This is now
fixed.

Addresses: #64793 (comment).
Fixes: #67744.

Release note: None

@yuzefovich yuzefovich requested review from jordanlewis, michae2 and a team July 19, 2021 16:49
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Whenever we're updating the length on the batch containing bytes-like
vectors, we are updating those vectors to have non-decreasing offsets.
In case the batch has a selection vector set, we're using the largest
index in the selection to update the offsets. This logic relies on the
assumption that the selection vector is set on the batch **before**
setting the length which wasn't the case in a couple of places.

In particular, the recent refactor of the case operator added the
support of bytes-like types as the output of the case operator, but the
existing code was setting the length on the batch first. This is now
fixed.

Release note: None
@yuzefovich
Copy link
Member Author

I think the incorrect order of setting things in the selection vector is the cause of several sentry reports (#67744, #61267, #60933), so I'll be backporting a minimal change to case.go to 20.2 and 21.1 branches.

Copy link
Collaborator

@michae2 michae2 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 8 of 8 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @jordanlewis)

@yuzefovich
Copy link
Member Author

TFTR!

bors r+

@yuzefovich yuzefovich changed the title colexec: fix recent case operator refactor a bit colexec: fix CASE operator a bit Jul 19, 2021
@craig
Copy link
Contributor

craig bot commented Jul 19, 2021

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

colexec: incorrectly setting batch length before restoring the selection vector in CASE operator
3 participants