[GLUTEN-12172][CH] Fix group limit first array result offset#12173
Merged
Conversation
RowNumGroupArraySorted writes aggregate results into a newly created ColumnArray. For the first output row the array offsets vector can be empty, but insertResultInto read result_array_offsets.back() before appending the first offset. That is undefined behavior and can crash when aggregate top-k writes its first result. Treat an empty offsets vector as having previous offset 0 before appending the next cumulative offset. Add a ClickHouse backend regression test that forces row_number top-k through the aggregate group limit path and validates the first array result row against vanilla Spark.
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes are proposed in this pull request?
RowNumGroupArraySorted writes aggregate results into a newly created ColumnArray. For the first output row the array offsets vector can be empty, but insertResultInto read result_array_offsets.back() before appending the first offset. That is undefined behavior and can crash when aggregate top-k writes its first result.
Treat an empty offsets vector as having previous offset 0 before appending the next cumulative offset. Add a ClickHouse backend regression test that forces row_number top-k through the aggregate group limit path and validates the first array result row against vanilla Spark.
closed #12172
How was this patch tested?
UTs
Was this patch authored or co-authored using generative AI tooling?
co-authored using generative AI tooling