Fix incorrect result of approx_percentile in window operations#10368
Closed
kagamiori wants to merge 1 commit intofacebookincubator:mainfrom
Closed
Fix incorrect result of approx_percentile in window operations#10368kagamiori wants to merge 1 commit intofacebookincubator:mainfrom
kagamiori wants to merge 1 commit intofacebookincubator:mainfrom
Conversation
Summary: approx_percentile(x, percentiles) returns incorrect result in a window operation where a frame that should return non-NULL follows a frame that returns NULL. Before the fix, the window operation returns NULL for both frames. This is because AggregationWindowFunction::computeAggregate() reuses the same result vector across frames. It calls BaseVector::prepareForReuse() before computing the aggregation for a frame. prepareForReuse() doesn't clear the nulls buffer of the vector as it expects the code that reuse the vector to set nulls properly. ApproxPercentileAggregate, however, doesn't set the result rows to be non-null in the code path for array-typed percentiles. This diff fixes this bug by setting the nulls buffer properly. Differential Revision: D59257658
✅ Deploy Preview for meta-velox canceled.
|
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D59257658 |
Yuhta
approved these changes
Jul 2, 2024
Contributor
|
This pull request has been merged in f5bfd1e. |
|
Conbench analyzed the 1 benchmark run on commit There was 1 benchmark result indicating a performance regression:
The full Conbench report has more details. |
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.
Summary:
approx_percentile(x, percentiles) returns incorrect result in a window
operation where a frame that should return non-NULL follows a frame
that returns NULL. Before the fix, the window operation returns NULL
for both frames. This is because
AggregationWindowFunction::computeAggregate() reuses the same
result vector across frames. It calls BaseVector::prepareForReuse()
before computing the aggregation for a frame. prepareForReuse()
doesn't clear the nulls buffer of the vector as it expects the code that
reuse the vector to set nulls properly. ApproxPercentileAggregate,
however, doesn't set the result rows to be non-null in the code path
for array-typed percentiles.
This diff fixes this bug by setting the nulls buffer properly.
Differential Revision: D59257658