You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "uros-b (via GitHub)" <gi...@apache.org> on 2026/08/07 10:31:32 UTC
Re: [PR] [SPARK-58062][SQL] Add `variant_strip_nulls` expression [spark]
uros-b commented on code in PR #56864:
URL: https://github.com/apache/spark/pull/56864#discussion_r3735132616
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala:
##########
@@ -996,6 +996,7 @@ object FunctionRegistry {
expressionBuilder("try_variant_set", TryVariantSetExpressionBuilder),
expressionBuilder("variant_array_append", VariantArrayAppendExpressionBuilder),
expressionBuilder("try_variant_array_append", TryVariantArrayAppendExpressionBuilder),
+ expression[VariantStripNulls]("variant_strip_nulls"),
Review Comment:
Registering with expression[VariantStripNulls] means variant_strip_nulls(v, include_arrays => false) fails — FunctionRegistry.expression[T] throws namedArgumentsNotSupported when it sees a NamedArgumentExpression.
variant_set / try_variant_set, the closest analogue (optional trailing boolean), register through expressionBuilder and declare the argument in a FunctionSignature, which is what makes create_if_missing => false legal:
```
// variantExpressions.scala:1196-1198
val createIfMissingArg =
InputParameter("create_if_missing", Some(Literal.create(true, BooleanType)))
Some(FunctionSignature(Seq(vArg, pathArg, valArg, createIfMissingArg)))
```
Using a VariantStripNullsExpressionBuilder would give named-argument support and let the default live in the signature rather than in the secondary constructor at variantExpressions.scala:1525.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org