-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add native stringview support for RIGHT #11955
Merged
alamb
merged 6 commits into
apache:main
from
Kev1n8:add-native-stringview-support-for-right
Aug 13, 2024
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7831dee
add stringview support for RIGHT
Kev1n8 42b8d6e
add tests of stringview support for RIGHT
Kev1n8 6506cab
combine functions by ArrayAccessor and ArrayIter
Kev1n8 630de25
fix fmt
Kev1n8 6739514
fix clippy
Kev1n8 459124b
fix fmt
Kev1n8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -809,16 +809,28 @@ logical_plan | |
03)----TableScan: test projection=[column1_utf8view] | ||
|
||
## Ensure no casts for RIGHT | ||
## TODO file ticket | ||
query TT | ||
EXPLAIN SELECT | ||
RIGHT(column1_utf8view, 3) as c2 | ||
FROM test; | ||
---- | ||
logical_plan | ||
01)Projection: right(CAST(test.column1_utf8view AS Utf8), Int64(3)) AS c2 | ||
01)Projection: right(test.column1_utf8view, Int64(3)) AS c2 | ||
02)--TableScan: test projection=[column1_utf8view] | ||
|
||
# Test outputs of RIGHT | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
query TTT | ||
SELECT | ||
RIGHT(column1_utf8view, 3) as c1, | ||
RIGHT(column1_utf8view, 0) as c2, | ||
RIGHT(column1_utf8view, -3) as c3 | ||
FROM test; | ||
---- | ||
rew (empty) rew | ||
eng (empty) ngpeng | ||
ael (empty) hael | ||
NULL NULL NULL | ||
|
||
## Ensure no casts for RPAD | ||
## TODO file ticket | ||
query TT | ||
|
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.
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.
Code below is quite similar to the
string_right
function, I wonder if it is possible to use theArrayAccessor
to reuse the code:https://github.com/apache/arrow-rs/blob/a693f0f9c37567b2b121e261fc0a4587776d5ca4/arrow-array/src/array/mod.rs#L438-L531
Similar to this pr: https://github.com/apache/datafusion/pull/11884/files#diff-e49633ca67d4035f244e96909aa4d9d9a484a933a7783bcdee3a6cf32dcd7ab8R76
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 advice. I couldn't come up with a proper way to combine them but now I get it :)