…gView equality kernels
### Rationale for this change
In apache#55171, direct comparison kernels were added between StringView/BinaryView and offset-based string types. Those kernels relied on `applicator::ScalarBinary` with `ArrayIterator<BinaryViewType>`, which eagerly calls `util::FromBinaryView` and resolves variadic payload pointers for every element regardless of match outcome.
As discussed in apache#55254, equality comparisons (`equal`, `not_equal`) can check the view's 4-byte inline prefix and string length before accessing payload buffers, rejecting mismatches early.
### What changes are included in this PR?
1. `util::EqualBinaryViewString`: Added in `arrow/util/binary_view_util.h` to compare a `BinaryViewType::c_type` with contiguous string data. It checks length and 4-byte prefix before dereferencing view variadic buffers.
2. Dedicated equality kernels: Implemented `ViewCompareViewEqual` and `ViewCompareStringEqual` in `scalar_compare.cc`, replacing eager iterator resolution for `equal` and `not_equal`.
3. Register-pinned scalar comparisons: For array-scalar operations, unpacked scalar length and prefix are pinned in registers outside the loop, avoiding repeated scalar lookups.
4. Tests: Extended `TestBinaryViewCompareKernel.ArrayArray` and `TestBinaryViewCompareKernel.ArrayScalar` with cases covering prefix mismatch, out-of-line equality, null bytes, and long strings.
### Are these changes tested?
Yes, extended existing parameterized tests in `scalar_compare_test.cc`.
### Are there any user-facing changes?
No.
### Was AI used for this PR?
AI was used to assist with kernel registration and testing under human direction.
**PR code and description written by:**
- [ ] Human
- [x] AI
**Reviewed before submission by:**
- [x] Human
- [x] AI
- [ ] Not reviewed
* GitHub Issue: apache#55254
Rationale for this change
In #55171, direct comparison kernels were added between StringView/BinaryView and offset-based string types. Those kernels relied on
applicator::ScalarBinarywithArrayIterator<BinaryViewType>, which eagerly callsutil::FromBinaryViewand resolves variadic payload pointers for every element regardless of match outcome.As discussed in #55254, equality comparisons (
equal,not_equal) can check the view's 4-byte inline prefix and string length before accessing payload buffers, rejecting mismatches early.What changes are included in this PR?
util::EqualBinaryViewString: Added inarrow/util/binary_view_util.hto compare aBinaryViewType::c_typewith contiguous string data. It checks length and 4-byte prefix before dereferencing view variadic buffers.ViewCompareViewEqualandViewCompareStringEqualinscalar_compare.cc, replacing eager iterator resolution forequalandnot_equal.TestBinaryViewCompareKernel.ArrayArrayandTestBinaryViewCompareKernel.ArrayScalarwith cases covering prefix mismatch, out-of-line equality, null bytes, and long strings.Are these changes tested?
Yes, extended existing parameterized tests in
scalar_compare_test.cc.Are there any user-facing changes?
No.
Was AI used for this PR?
AI was used to assist with kernel registration and testing under human direction.
PR code and description written by:
Reviewed before submission by: