-
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
Implement native support StringView for overlay #11968
Merged
+153
−67
Merged
Changes from all commits
Commits
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
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 |
---|---|---|
|
@@ -719,16 +719,23 @@ logical_plan | |
02)--TableScan: test projection=[column1_utf8view] | ||
|
||
## Ensure no casts for OVERLAY | ||
## TODO file ticket | ||
query TT | ||
EXPLAIN SELECT | ||
OVERLAY(column1_utf8view PLACING 'foo' FROM 2 ) as c1 | ||
FROM test; | ||
---- | ||
logical_plan | ||
01)Projection: overlay(CAST(test.column1_utf8view AS Utf8), Utf8("foo"), Int64(2)) AS c1 | ||
01)Projection: overlay(test.column1_utf8view, Utf8View("foo"), Int64(2)) AS c1 | ||
02)--TableScan: test projection=[column1_utf8view] | ||
|
||
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. Likewise, can we please also add actually running these queries to the tests like query
SELECT OVERLAY(column1_utf8view PLACING 'foo' FROM 2 ) as c1 ? 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. Done! 907e27e |
||
query T | ||
SELECT OVERLAY(column1_utf8view PLACING 'foo' FROM 2 ) as c1 FROM test; | ||
---- | ||
Afooew | ||
Xfoogpeng | ||
Rfooael | ||
NULL | ||
|
||
## Ensure no casts for REGEXP_LIKE | ||
query TT | ||
EXPLAIN SELECT | ||
|
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.
It would be nice to have some sort of trait in arrow-rs that allowed us to write this as a generic function
It actually does have
https://github.com/apache/arrow-rs/blob/2461a16c19ee5032531b1c05dd7e7192bc842e0f/arrow-string/src/like.rs#L158-L161
But that is not public
@XiangpengHao do you know of anything that is pub?
We could also implement such a trait for DataFusion's convenience, and then propose upstreaming it 🤔
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 was just behind -- it seems that @Omega359 did exactly this in
StringArrayType
#11941datafusion/datafusion/functions/src/unicode/lpad.rs
Lines 251 to 263 in 94034be
Maybe we can start to pull that trait into its own module and start reusing it across the string functions 🤔
Also, there is the
ArrayAccessor
pattern used elegantly by @devanbenz in #11967 🤔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 current style is inspired by rpad in #11942 . I'll be rewriting it with
ArrayAccessor
, which I've used in other PRs, and it's a much more elegant way.