Skip to content

colexec: fix bytes corruption for disk-spilled window functions#69024

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
DrewKimball:truncate
Aug 17, 2021
Merged

colexec: fix bytes corruption for disk-spilled window functions#69024
craig[bot] merged 1 commit intocockroachdb:masterfrom
DrewKimball:truncate

Conversation

@DrewKimball
Copy link
Copy Markdown
Collaborator

This patch fixes the Truncate method for bytes columns so that it
updates the offsets to be non-decreasing up to the new maxSetLength.
This is necessary in the case when the new maxSetLength is greater
than the old one.

This can happen when a window function has a bytes output column and
the SpillingQueue that buffers input batches spills to disk. If a
batch has trailing nulls up to the last processed index, and it is
immediately enqueued to disk, SpillingQueue does not call SetLength
on the batch, so the offsets still need to be updated (in this case by
Truncate).

Fixes #60824

Release note: None

This patch fixes the `Truncate` method for bytes columns so that it
updates the offsets to be non-decreasing up to the new `maxSetLength`.
This is necessary in the case when the new `maxSetLength` is greater
than the old one.

This can happen when a window function has a bytes output column and
the `SpillingQueue` that buffers input batches spills to disk. If a
batch has trailing nulls up to the last processed index, and it is
immediately enqueued to disk, `SpillingQueue` does not call `SetLength`
on the batch, so the offsets still need to be updated (in this case by
`Truncate`).

Fixes cockroachdb#60824

Release note: None
@DrewKimball DrewKimball requested a review from yuzefovich August 17, 2021 05:06
@DrewKimball DrewKimball requested a review from a team as a code owner August 17, 2021 05:06
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

:plause: for figuring out the end-to-end regression test! :lgtm:

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

@DrewKimball
Copy link
Copy Markdown
Collaborator Author

TFTR!

@DrewKimball
Copy link
Copy Markdown
Collaborator Author

Bazel failure looks like an unrelated test timout.

@DrewKimball
Copy link
Copy Markdown
Collaborator Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 17, 2021

Build succeeded:

@craig craig bot merged commit b69e790 into cockroachdb:master Aug 17, 2021
@DrewKimball DrewKimball deleted the truncate branch August 17, 2021 17:54
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.

sql/logictest: TestLogic failed

3 participants