Awesome06 opened a new pull request, #55425:
URL: https://github.com/apache/arrow/pull/55425

   ### Rationale for this change
   
   In #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 #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: https://github.com/apache/arrow/issues/55254
   


-- 
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]

Reply via email to