Conversation
|
|
|
|
There was a problem hiding this comment.
🟢 Approval recommended
The change correctly addresses the sliced-offset bitmap bug and includes targeted regression tests, with only a minor optional performance optimization noted.
Pull request overview
Fixes winsorize producing an incorrect null pattern when the input is a sliced ArrayData with a non-zero offset, by ensuring the output’s zero-offset validity bitmap matches the slice rather than the parent.
Changes:
- Copy the validity bitmap slice into the zero-offset output in
Winsorize::ClipValues(instead of sharing the input bitmap buffer). - Add regression coverage for sliced floating-point and integer inputs (plus a null-free sliced input case).
File summaries
| File | Description |
|---|---|
| cpp/src/arrow/compute/kernels/vector_statistics.cc | Ensures winsorize output validity bitmap matches sliced input offsets by copying the relevant bits. |
| cpp/src/arrow/compute/kernels/vector_statistics_test.cc | Adds a regression test verifying correct null placement for sliced inputs across numeric types. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
ClipValues doesn’t explicitly force out->offset = 0, which can break correctness and potentially cause out-of-bounds writes when invoked with a non-zero output offset (e.g., sliced chunks in the chunked path).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
There was a problem hiding this comment.
🟢 Approval recommended
The fix directly addresses the reported offset/bitmap bug with a targeted, safe change and includes a focused regression test that fails before and passes after the patch.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
🟢 Approval recommended
The fix is localized, addresses the described root cause (offset-aware validity), and is covered by targeted regression tests.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
|
|
|
|
|
|
|
fdcef26 to
88f8f56
Compare
|
|
|
|
88f8f56 to
52b330f
Compare
…d array The output is zero-offset, so sharing a sliced input's validity buffer made readers interpret it from bit 0 and move the nulls. Signed-off-by: 1fanwang <1fannnw@gmail.com>
… sliced A zero-offset input is read from bit 0 in both the input and the output, so copying it only adds an allocation. Signed-off-by: 1fanwang <1fannnw@gmail.com>
Signed-off-by: 1fanwang <1fannnw@gmail.com>
ExecChunked seeds the output from the input chunk, so a sliced chunk carried its offset into buffers built for the slice alone. Signed-off-by: 1fanwang <1fannnw@gmail.com>
Signed-off-by: 1fanwang <1fannnw@gmail.com>
Signed-off-by: 1fanwang <1fannnw@gmail.com>
52b330f to
97da9e3
Compare
|
|
|
|
Rationale for this change
Winsorizing a sliced array can put nulls in the wrong positions. Slices containing only nulls or NaNs can also return values from outside the slice.
Closes #51224.
What changes are included in this PR?
Use the bitmap helper to match validity bits to the output values. Preserve the input offset when returning the original buffers.
Are these changes tested?
I ran the native C++ tests and PyArrow on macOS arm64 with Apple clang 21. The new regression covers null-only, NaN-only and mixed null/NaN slices, with chunked inputs as controls.
With PyArrow loading the native library being tested, save this as repro-winsorize.py:
Raw logs
Before:
After:
Are there any user-facing changes?
Sliced inputs retain the correct values and null positions.
Was AI used for this PR?
In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.
PR code and description written by:
Reviewed before submission by: