-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Update RPAD scalar function to support Utf8View #11942
Conversation
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 @Lordworms 🙏 . I had a few questions about this PR but it is looking close
} | ||
_ => Ok(None), | ||
}) | ||
.collect::<Result<GenericStringArray<T>>>() |
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.
This means the result of rpad
is always GenericStringArray
(Utf8Array
) right?
I wonder if it would make sense to produce the same output type as the first argument 🤔 For the string view case eventually I could imagine reusing the same underlying buffers if the string had nothing to pad.
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.
lpad was the same here iirc
You may want to look at the tests I added in #11941 as an example to verify that all the signature variants are tested. |
I'll add that, thanks for reminding |
I may directly reference the test case there, is it ok? |
It currently hardcodes the LPadFunc in it so it'll require a refactor but given how close these two functions are I can't see an issue off the top of my head. |
} | ||
macro_rules! process_rpad { | ||
// For the two-argument case | ||
($string_array:expr, $length_array:expr, $is_view:expr) => {{ |
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.
is_view looks to be unused and it always passed in true. Should be removed unless I missed something.
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 agree -- removing it would simplify this PR
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.
Sure, I'll remove it soon
Thank you @Lordworms and @Omega359 |
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.
Looks good to me @Lordworms and @Omega359
An epic journey of macros 🚀
I can't help but think this function could be made much faster by using a StringBuilder rather than creating a bunch of String
s which are then copied.
However, that could be some future pR
@Omega359's PR here is a pretty good example of how to do this #11987 |
Sure, I'll add a PR for it tomorrow. |
Filed
Filed #11997 to track |
Which issue does this PR close?
Closes #11918
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?