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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]