You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C++][Python] pairwise_diff ignores array offsets for sliced inputs #50524
ArraySpan::SetSlice() assigns the provided value as an absolute offset rather than adding it to the existing input offset.
For a sliced input, the shifted spans therefore index from the parent buffers rather than from input.offset.
The validity calculation still uses the original input offset, so the value and validity spans may also refer to different logical elements.
Affected inputs
The issue affects sliced inputs where:
offset > 0
0 < abs(period) < length
It is reproducible for both positive and negative periods and affects numeric, decimal, and temporal kernel signatures that share this implementation.
Proposed direction
Preserve the original input offset when creating the shifted operand spans, and add focused C++ regression coverage for sliced inputs.
I searched existing open and closed issues, pull requests, commits, release notes, tests, and source history and did not find an existing report for this sliced-array offset bug.
I reproduced this in both PyArrow and the public C++ API and have a small C++ fix with focused regression coverage scoped out. I’d be happy to work on it if the proposed direction looks appropriate.
Is anyone actively working on this? You mentioned on Jul 16 that you had a small C++ fix with focused regression coverage scoped out — if you're still planning to send it, please go ahead; I don't want to duplicate your work.
If you'd rather hand it off, I'm happy to pick it up. I had a look at the kernel and the offset does need to be threaded through consistently: pairwise_diff reads the input values relative to the parent buffer instead of the sliced view, so the first output subtracts the pre-slice element (the -98 in your example). A focused fix plus a regression test over a sliced input covering both pairwise_diff and pairwise_diff_checked looks right. Just let me know which way you'd prefer.
Activity
hsusul commentedon Jul 16, 2026
I reproduced this in both PyArrow and the public C++ API and have a small C++ fix with focused regression coverage scoped out. I’d be happy to work on it if the proposed direction looks appropriate.
Alb3e3 commentedon Jul 28, 2026
Is anyone actively working on this? You mentioned on Jul 16 that you had a small C++ fix with focused regression coverage scoped out — if you're still planning to send it, please go ahead; I don't want to duplicate your work.
If you'd rather hand it off, I'm happy to pick it up. I had a look at the kernel and the offset does need to be threaded through consistently:
pairwise_diffreads the input values relative to the parent buffer instead of the sliced view, so the first output subtracts the pre-slice element (the-98in your example). A focused fix plus a regression test over a sliced input covering bothpairwise_diffandpairwise_diff_checkedlooks right. Just let me know which way you'd prefer.GH-50524: [C++] Honor array offset in pairwise_diff (#50858)
pitrou commentedon Aug 25, 2026
Issue resolved by pull request 50858
#50858