-
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 concat_ws
scalar function to support Utf8View
#11837
Comments
concat_ws
scalar function to support Utf8Viewconcat_ws
scalar function to support Utf8View
take |
@dharanad Are you still working on this? If not I can take it on. I have done a few of the other StringView implementations so its fresh for me and can likely get it done relatively quickly. |
Hey @devanbenz please feel free to take it. |
take |
@devanbenz Do you maybe want to also look at #11836? It looks like concat and concat_ws share a good chunk of code, so perhaps it'd be better to have the approach to be similar. |
@tshauck can do! |
I have a PR out for #12224 Will wait for that to get a review then work on this so I can adapt the changes here. 👍 |
Part of #11752 and #11790
Currently, a call to
CONCAT_WS
with a Utf8View datatypes induces a cast. After the change that fixes this issue, it should not.concat_ws is defined here: https://github.com/apache/datafusion/blob/main/datafusion/functions/src/string/concat_ws.rs
Is your feature request related to a problem or challenge?
We are working to add complete StringView support in DataFusion, which permits potentially much faster processing of string data. See #10918 for more background.
Today, most DataFusion string functions support DataType::Utf8 and DataType::LargeUtf8 and when called with a StringView argument DataFusion will cast the argument back to DataType::Utf8 which is expensive.
To realize the full speed of StringView, we need to ensure that all string functions support the DataType::Utf8View directly.
Describe the solution you'd like
Update the function to support DataType::Utf8View directly
Describe alternatives you've considered
The typical steps are:
string_view.slt
to ensure the arguments are not being castSignature
of the function to acceptUtf8View
in addition toUtf8
/LargeUtf8
Utf8View
Example PRs
Utf8View
type instarts_with
function #11787StringViewArray
#11556Additional context
The documentation of string functions can be found here: https://datafusion.apache.org/user-guide/sql/scalar_functions.html#string-functions
To test a function with StringView with
datafusion-cli
you can use an example like this (replacingstarts_with
with the relevant function)To see if it is using utf8 view, use
EXPLAIN
to see the plan and verify there is noCAST
. In this example theCAST(column1@0 AS Utf8)
indicates that the function is not usingUtf8View
nativelyIt is also often good to test with a constant as well (likewise there should be no cast):
The text was updated successfully, but these errors were encountered: