-
Notifications
You must be signed in to change notification settings - Fork 3.7k
GH-46683: Add utf8_zfill kernel for sign-aware zero padding #46815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@pitrou Just wanted to give you a heads-up that the implementation and tests are ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @iabhi4 !
The CI failures look connected. For example:
/arrow/cpp/src/arrow/compute/kernels/scalar_string_internal.h:179: Check failed: _s.ok() Operation failed: registry->AddFunction(std::move(func))
Bad status: Invalid: In function 'utf8_zfill': description line length exceeds 78 characters
We do not require changelog entry per PR - it is done automatically at the release. As for the documentation, on the Python side, the User Guide is very minimal at this point and so the work would be out of scope of this PR (will keep in mind to maybe add a new issue under #46601).
That being said, I would love if we would have a short example here: https://arrow.apache.org/docs/dev/python/generated/pyarrow.compute.PadOptions.html, even if only for the new utf8_zfill
kernel 😊
Thanks for the review @AlenkaF, took care of the CI errors and added an |
@github-actions crossbow submit preview-docs |
Revision: 7d33c20 Submitted crossbow builds: ursacomputing/crossbow @ actions-08f3ce64cb
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a suggestion of mine might have been lost during the review stage. What I meant to propose was setting |
What does this PR do?
Adds a new compute kernel
utf8_zfill
to Arrow Compute module. This kernel zero-pads UTF-8 strings while preserving leading signs.Why is it needed?
Python's
str.zfill()
behavior is useful and expected in many data cleaning scenarios. Arrow lacked a direct equivalent.Implementation details
Utf8ZFillTransform
Are these changes tested?
TestStringKernels, Utf8ZFill
test_utf8_zfill()
Ran both tests
utf8_zfill
in pyarrow.compute to supportstr.zfill
behavior #46683