feat(spark): add concat_ws with array support#20928
Draft
davidlghellin wants to merge 2 commits intoapache:mainfrom
Draft
feat(spark): add concat_ws with array support#20928davidlghellin wants to merge 2 commits intoapache:mainfrom
concat_ws with array support#20928davidlghellin wants to merge 2 commits intoapache:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Spark-compatible support for concat_ws in the DataFusion Spark shim, including array-argument expansion semantics, and replaces previously-commented SLT examples with executable Spark SQLLogicTest coverage.
Changes:
- Register new Spark UDF
concat_wsin the Spark string function module. - Implement
SparkConcatWswith support for array arguments and Spark-style null handling. - Expand
concat_ws.sltinto a broader suite of executable tests (scalar, arrays, columns, and edge cases).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| datafusion/sqllogictest/test_files/spark/string/concat_ws.slt | Converts commented examples into runnable SLT queries and adds broader coverage for Spark concat_ws behavior. |
| datafusion/spark/src/function/string/mod.rs | Registers and exports the new Spark concat_ws UDF. |
| datafusion/spark/src/function/string/concat_ws.rs | New Spark-compatible concat_ws implementation (including array expansion) plus unit tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
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?
Part of #15914
Rationale for this change
DataFusion core's
concat_wsdoes not support array arguments. Spark'sconcat_ws(sep, ...)accepts both scalar strings and arrays, expanding array elements and skipping nulls. This is needed for Spark compatibility in thedatafusion-sparkcrate.What changes are included in this PR?
SparkConcatWsUDF indatafusion/spark/src/function/string/concat_ws.rsconcat_ws(sep, str1, str2, ...)with scalar stringsconcat_ws(',', array('a', 'b'), 'c')→"a,b,c"concat_ws(',')) returns empty stringmod.rs(make_udf_function!,export_functions!,functions())Are these changes tested?
Yes.
concat_ws.rs(basic, null values skipped, null separator, list arrays, list with nulls, mixed scalar+list, multiple rows)spark/string/concat_ws.sltcovering scalars, arrays, nulls, column expressions, and edge casesAre there any user-facing changes?
No. This is a new function in the
datafusion-sparkcrate only.