chrikrah opened a new issue, #55410:
URL: https://github.com/apache/arrow/issues/55410

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   The docstrings of `utf8_is_printable` and `ascii_is_printable` say an empty 
string gives false. Both kernels return true for it.
   
   ```python
   import pyarrow as pa
   import pyarrow.compute as pc
   
   print(pa.__version__)
   a = pa.array(["", "a", None])
   for fn in (pc.utf8_is_printable, pc.ascii_is_printable, pc.utf8_is_alpha):
       print(fn.__name__, fn(a).to_pylist())
   print(pc.utf8_is_printable.__doc__.splitlines()[2:4])
   ```
   
   ```
   $ python -I pr.py    # pyarrow 26.0.0 wheel, Python 3.14, Linux x86_64
   26.0.0
   utf8_is_printable [True, True, None]
   ascii_is_printable [True, True, None]
   utf8_is_alpha [False, True, None]
   ['For each string in `strings`, emit true iff the string is non-empty', 'and 
consists only of printable Unicode characters.  Null strings emit null.']
   ```
   
   contract: the generated docstring above, from `StringClassifyDoc(..., 
/*non_empty=*/true)` at 
`cpp/src/arrow/compute/kernels/scalar_string_utf8.cc:313` and 
`scalar_string_ascii.cc:671` (`aae29bf`). The user guide says the same for the 
whole String predicates table, "An empty string element emits false in the 
output" (`docs/source/cpp/compute.rst:905`), with no note on the two printable 
rows.
   
   The behaviour looks deliberate. Both kernels instantiate their predicate 
with `/*allow_empty=*/true` (`scalar_string_utf8.cc:242`, 
`scalar_string_ascii.cc:599`), the C++ tests assert `""` gives true 
(`IsPrintableUnicode`, `IsPrintableAscii`), and `"".isprintable()` is `True` in 
Python, the function `test_string_py_compat_boolean` compares against.
   
   Expected: both docs pass `false` to `StringClassifyDoc`, giving "emit true 
iff the string consists only of printable ... characters", and `compute.rst` 
gets a note on `ascii_is_printable` and `utf8_is_printable` saying an empty 
string emits true.
   
   I read the source at `aae29bf` and ran the 26.0.0 wheel, not a source build.
   
   I'll follow up with a PR that flips both arguments and adds the note in 
`compute.rst`.
   
   ### Component(s)
   
   C++, Documentation, Python
   


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