GH-46589: [C++] Fix utf8_is_digit to support full Unicode digit range#46590
Merged
pitrou merged 2 commits intoapache:mainfrom Jun 2, 2025
Merged
GH-46589: [C++] Fix utf8_is_digit to support full Unicode digit range#46590pitrou merged 2 commits intoapache:mainfrom
pitrou merged 2 commits intoapache:mainfrom
Conversation
|
Thanks for opening a pull request! If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project. Then could you also rename the pull request title in the following format? or See also: |
6fa58c2 to
5cbabcf
Compare
pitrou
reviewed
May 27, 2025
ce442e7 to
47e2683
Compare
47e2683 to
ce92151
Compare
Member
|
I pushed a quick fix for the C++ lint failures, will merge. |
|
After merging your PR, Conbench analyzed the 0 benchmarking runs that have been run so far on merge-commit dc0f5a9. None of the specified runs were found on the Conbench server. The full Conbench report has more details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
pyarrow.compute.utf8_is_digitdid not recognize valid Unicode digit characters (e.g., superscripts like'³'), diverging from the behavior of Python's built-instr.isdigit()This caused inconsistencies in downstream libraries like pandas when using PyArrow-backed StringDtype.
What changes are included in this PR?
Updated
IsDigitCharacterUnicodeimplementation to cover a broader range of Unicode digits by replacing category check with one that aligns with Python’sstr.isdigit()semantics.Added tests in
scalar_string_test.ccto validate correct digit detection across diverse Unicode digit inputs.Are these changes tested?
Yes. New unit tests were added and pass successfully, verifying behavior on various Unicode digit characters.
Are there any user-facing changes?
Yes, users relying on
pc.utf8_is_digit()will now get correct results for a wider range of Unicode digit characters, improving correctness and parity with Python semanticsutf8_is_digitin PyArrow doesn't fully match Python'sstr.isdigit()(e.g., fails for '³') #46589