hcrosse opened a new pull request, #1458: URL: https://github.com/apache/arrow-go/pull/1458
### Rationale for this change `not` on a sliced boolean array can put nulls on the wrong rows. For example, `[null, true, null, false]` sliced from offset 1 produces `[(null) true (null)]` instead of `[false (null) true]`, with no error. ### What changes are included in this PR? `not` now uses `NullIntersection` while keeping `MemPrealloc`, like `and`, `or`, `xor` and `and_not`. Arrow C++'s [`invert`](https://github.com/apache/arrow/blob/0ab78e2df489055b71a7d26a666a52823f87f01c/cpp/src/arrow/compute/kernels/scalar_boolean.cc#L488) uses the same null handling with preallocation. The executor already handles input offsets, chunked input and exec chunks for these kernels, so `not` no longer needs its own validity code. The kernel now only inverts values. For unchunked input with nulls, each call now allocates and copies one validity bitmap of `ceil(n/8)` bytes, where an offset-0 input could previously share its buffer. Unchunked input without nulls gets no validity bitmap. Chunked input always gets a preallocated validity bitmap, even when no chunk has nulls, and now comes back as one contiguous array. ### Are these changes tested? I added `TestBooleanNotSliced`, which covers offsets 0, 1 and 9, an array without a validity buffer sliced at offset 7, chunked input with one chunk lacking a validity buffer, and a small `ChunkSize`. On main, offsets 1 and 9, `chunked` and `small exec chunks` fail. On Linux amd64, `go test -count=1 ./arrow/compute/...`, `go vet`, `gofmt` and `golangci-lint` passed, along with the `prek` hooks on the changed files, including the Release Audit Tool. ### Are there any user-facing changes? Yes. `not` returns the correct nulls on sliced boolean arrays. There is no API change. Closes https://github.com/apache/arrow-go/issues/1455. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
