-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(spark): implement StringView for SparkConcat
#19984
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
Open
aryan-212
wants to merge
4
commits into
apache:main
Choose a base branch
from
aryan-212:utf8view-sparkconcat
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+57
−5
Conversation
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
fc92fa6 to
e052fa3
Compare
StringView for SparkConcatStringView for SparkConcat
Weijun-H
reviewed
Jan 25, 2026
Member
Weijun-H
left a comment
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, thanks @aryan-212 👍
It is better to add some mixed type tests
# Test mixed types: Utf8View + Utf8
query T
SELECT concat(arrow_cast('hello', 'Utf8View'), ' world');
----
hello world
# Test all three types mixed together
query T
SELECT concat('a', arrow_cast('b', 'LargeUtf8'), arrow_cast('c', 'Utf8View'));
----
abc
d791634 to
9329a43
Compare
Author
|
Added them @Weijun-H, thanks for reviewing 🙇 |
Jefffrey
reviewed
Jan 25, 2026
ad92725 to
7bb3ba0
Compare
7bb3ba0 to
02362fe
Compare
Jefffrey
reviewed
Jan 25, 2026
1c997dc to
28156b8
Compare
Author
|
@Jefffrey , made the required test changes. Please have a look 🙇 |
Jefffrey
approved these changes
Jan 25, 2026
3715990 to
577b604
Compare
577b604 to
1358178
Compare
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?
Utf8Viewsupport in the Spark-compat layer.Rationale for this change
In our internal project we're only suppporting
Utf8View(because of design constraints) and the current implementation ofSparkConcatonly supportsUtf8. TheSparkConcatfunction should acceptUtf8Viewand mixed string types in line with the main DataFusion concat. This PR adds that support and follows the same patterns as DataFusion’s concat.Prevents errors like :
from a query like:-
What changes are included in this PR?
Extend the type signature to accept
Utf8Viewin addition toUtf8andLargeUtf8viaTypeSignature::Variadic(vec![Utf8View, Utf8, LargeUtf8])matching DataFusion’s concat.In
return_field_from_args, compute the result type with precedence Utf8View > LargeUtf8 > Utf8.In spark_concat, handle Utf8View and LargeUtf8 in scalar paths (zero-argument and all-NULL).
Are these changes tested?
Yes.
cargo test --package datafusion-spark function::string::concat::tests, includingtest_concat_utf8view.spark/string/concat.sltincludes a “Utf8View: no extra CAST in plan” case that uses EXPLAIN and a temporary table to ensure no extra CASTs when using arrow_cast(..., 'Utf8View') with table columns.Are there any user-facing changes?
used gpt to rephrase some of these points