fix: Avoid unnecessary type casts in concat_ws#20436
Open
neilconway wants to merge 3 commits intoapache:mainfrom
Open
fix: Avoid unnecessary type casts in concat_ws#20436neilconway wants to merge 3 commits intoapache:mainfrom
concat_ws#20436neilconway wants to merge 3 commits intoapache:mainfrom
Conversation
Contributor
|
I did a quick look at the changes and nothing obvious jumped out at me. I'll try and find time to do a more extensive review if no one else beats me to it. |
Contributor
Author
|
@Omega359 Thank you! |
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.
Which issue does this PR close?
Rationale for this change
concat_wsreturnedUtf8, regardless of the input types it was called with. If it was called withLargeUtf8, returningUtf8might overflow. In general, functions like these should operate on all three string representations unless there is a compelling reason not to (e.g., this is howconcatworks).simplify_concat_wsalways constructed new literals with typeUtf8. This lead to unnecessary casts when its inputs were of a different string type.What changes are included in this PR?
concat_wsreturn type matching its input types, following howconcatdoes it.simplify_concat_ws, construct literals with the right type, not alwaysUtf8return_typeforconcatto be more readableStringViewArrayBuilderAPI more similar to the other string array builders, WRT null handlingAre these changes tested?
Yes.
Are there any user-facing changes?
Yes: some queries involving
concat_wswill now omit unnecessary cast operations, and the return type ofconcat_wsmight be any of the three string types. Generally these changes should match user expectations better than the previous behavior.