arrow icon indicating copy to clipboard operation
arrow copied to clipboard

[C++][Compute] Vector replace kernels (replace_with_mask, fill_null) do not support string_view, binary_view, decimal32, or decimal64

Open Awesome06 opened this issue 1 month ago • 3 comments

Describe the bug

The vector replacement compute functions (replace_with_mask, fill_null_forward, and fill_null_backward) fail with arrow::Status::NotImplemented when called on string_view, binary_view, decimal32, or decimal64 arrays.

In cpp/src/arrow/compute/kernels/vector_replace.cc, RegisterVectorFunction registers BaseBinaryTypes(), DECIMAL128, and DECIMAL256, but omits registrations and functors for string/binary views and 32-bit / 64-bit decimals.

Minimal Reproduction

import pyarrow as pa
import pyarrow.compute as pc

# 1. string_view
arr = pa.array(["apple", None, "cherry"], type=pa.string_view())
mask = pa.array([False, True, False])
repl = pa.array(["banana"], type=pa.string_view())

pc.replace_with_mask(arr, mask, repl)
# ArrowNotImplementedError: Function 'replace_with_mask' has no kernel matching input types (string_view, boolean, string_view)

pc.fill_null_forward(arr)
# ArrowNotImplementedError: Function 'fill_null_forward' has no kernel matching input types (string_view)

# 2. decimal32
dec_arr = pa.array([1234, None, 5678], type=pa.decimal32(7, 2))
dec_repl = pa.array([9999], type=pa.decimal32(7, 2))

pc.replace_with_mask(dec_arr, mask, dec_repl)
# ArrowNotImplementedError: Function 'replace_with_mask' has no kernel matching input types (decimal32(7, 2), boolean, decimal32(7, 2))

Expected Behavior

  • replace_with_mask(arr, mask, repl) returns string_view array ["apple", "banana", "cherry"].
  • fill_null_forward(arr) returns string_view array ["apple", "apple", "cherry"].
  • replace_with_mask(dec_arr, mask, dec_repl) returns decimal32(7, 2) array ["12.34", "99.99", "56.78"].

Awesome06 avatar Oct 26 '26 05:10 Awesome06

I would like to work on this issue, starting with the decimal32/decimal64 registration gap and verifying whether the view-type support can be safely split into a follow-up if it needs separate buffer-handling machinery.

I will add focused C++ regression coverage for the supported scope, validate the behavior on current main, and open a PR once the change is ready.

Disclosure: Slai Agent Runtime is assisting with analysis, implementation, testing, and preparation. The account owner authorizes and reviews the work and takes full responsibility for the submission.

huong8373tt-beep avatar Oct 26 '26 05:10 huong8373tt-beep

Hey @huong8373tt-beep, I am actually working on this issue already.

Awesome06 avatar Oct 26 '26 05:10 Awesome06

Thanks for letting me know. I will not proceed with a competing implementation. Good luck with the fix.

huong8373tt-beep avatar Oct 26 '26 06:10 huong8373tt-beep