Commit a2a9dce
authored
### 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.
* GitHub Issue: #50524
Authored-by: Krishnanand G <118352827+Krishnanand-G@users.noreply.github.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
1 parent 9b96d70 commit a2a9dce
2 files changed
Lines changed: 24 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
76 | 78 | | |
77 | | - | |
| 79 | + | |
78 | 80 | | |
79 | | - | |
| 81 | + | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
154 | 174 | | |
155 | 175 | | |
156 | 176 | | |
| |||
0 commit comments