Skip to content

GH-50524: [C++] Honor array offset in pairwise_diff - #50858

Open
Krishnanand-G wants to merge 1 commit into
apache:mainfrom
Krishnanand-G:fix-gh-50524-pairwise-diff-offset
Open

GH-50524: [C++] Honor array offset in pairwise_diff#50858
Krishnanand-G wants to merge 1 commit into
apache:mainfrom
Krishnanand-G:fix-gh-50524-pairwise-diff-offset

Conversation

@Krishnanand-G

Copy link
Copy Markdown

Rationale for this change

ArraySpan::SetSlice replaces the offset. pairwise_diff copied the input span and then sliced from left_start/right_start, so a sliced array was read from the parent buffer. With [99, 1, 4, 9, 16] sliced to [1, 4, 9, 16], period=1 produced [-98, 3, 5, 7] instead of [null, 3, 5, 7].

What changes are included in this PR?

The kernel passes input.offset + left_start (and the same for the right side). The regression test uses a sliced int64 array for both period signs, on pairwise_diff and pairwise_diff_checked.

Are these changes tested?

Yes, TestPairwiseDiff.SlicedInput in vector_pairwise_test.cc.

Are there any user-facing changes?

pairwise_diff on a sliced array now diffs the sliced values. Callers who passed a slice and got parent-buffer values will see different (correct) output.

@Krishnanand-G
Krishnanand-G requested a review from pitrou as a code owner August 13, 2026 10:16
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #50524 has been automatically assigned in GitHub to PR creator.

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #50524 has no components, please add labels for components.

@uros-b

uros-b commented Aug 13, 2026

Copy link
Copy Markdown
Member

LGTM

@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants