fix: Support concat_ws with literal NULL separator#3542
fix: Support concat_ws with literal NULL separator#3542andygrove merged 4 commits intoapache:mainfrom
Conversation
|
Tes failures : |
|
@0lai0 , @andygrove . We might want to hold off onto this PR before merging. There is a test failure and I am not sure we covered all possible Error (with plan) |
|
We have 2 options here .
|
spark/src/test/resources/sql-tests/expressions/string/concat_ws.sql
Outdated
Show resolved
Hide resolved
spark/src/test/resources/sql-tests/expressions/string/concat_ws.sql
Outdated
Show resolved
Hide resolved
…s.sql Co-authored-by: B Vadlamani <11091419+coderfender@users.noreply.github.com>
|
Thanks @andygrove and @coderfender for review. I think we need to open a follow up issue. |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thanks for the fix, @0lai0! The null separator handling is clean. I pushed a small addition to handle the case where all The new case in Note that the null separator check still comes first, so |
|
@coderfender ok to merge this one now? |
|
Yup ! Thank you for fixing tests @0lai0 @andygrove |
|
Thanks @andygrove and @coderfender ! |
Which issue does this PR close?
Closes #3339
Rationale for this change
When Spark's
ConstantFoldingoptimizer rule is disabled,concat_wswith a literal NULL separator is pushed down to the native engine and currently causes a crash with:Expected string literal, got None.Spark's semantics for
concat_wsare that a NULL separator should yield a NULL result. We should either match Spark's behavior or fall back gracefully instead of crashing the native engine.What changes are included in this PR?
CometConcatWsserde handler that rewritesconcat_wswith a literal NULL separator to a NULL literal, matching Spark semantics.QueryPlanSerdeto mapConcatWstoCometConcatWsinstead of the genericCometScalarFunction("concat_ws").concat_wsquery inspark/src/test/resources/sql-tests/expressions/string/concat_ws.sqlthat was previously ignored due to this bug.How are these changes tested?
./mvnw test -Dsuites="org.apache.comet.CometSqlFileTestSuite concat_ws" -Dtest=none