-
Notifications
You must be signed in to change notification settings - Fork 161
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
feat: add center function #282
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.
The description is not very explicit about it needing to be a single character; character
vs characters
could easily be misinterpreted as a typo. This is especially problematic because the prototypes allow anything from 0 to 2^31-1 characters to be specified for character
. The varchar<L2>
could at least be made a varchar<1>
to make it 0 or 1 character in that case, though that doesn't really solve the problem completely and doesn't solve anything for the string
variant... The closest thing to a character type that Substrait has is fixedchar<1>
, but using that bends the rules of #251.
I'm on the fence about what the right approach is, but if we stick to the implementations as currently defined, the description should state what happens if != 1 characters are passed to the character
argument (throw error that fails the whole query? return null? use first character for >1 and use space for 0 characters? something else? explicitly undefined/up to the consumer to decide?)
Updated the description and arg implementation to specify 1 character. For now, i've also just explicitly stated the undefined behavior if the number of characters passed to the |
d851137
to
bd569de
Compare
bd569de
to
e9ed571
Compare
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.
LGTM. CI failure is due to a network failure.
PR to add center function.
Originally worked on in #248.
Instead of allowing a string with multiple characters to be used as padding, like lpad and rpad, center will only allow a single character for padding.