cloud-fan commented on code in PR #58124:
URL: https://github.com/apache/spark/pull/58124#discussion_r3826617490


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/WrapUDT.scala:
##########
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.catalyst.expressions
+
+import org.apache.spark.sql.AnalysisException
+import org.apache.spark.sql.catalyst.analysis.TypeCheckResult
+import org.apache.spark.sql.catalyst.analysis.TypeCheckResult.DataTypeMismatch
+import org.apache.spark.sql.catalyst.expressions.Cast._
+import org.apache.spark.sql.catalyst.expressions.codegen.{CodegenContext, 
ExprCode}
+import org.apache.spark.sql.catalyst.types.DataTypeUtils
+import org.apache.spark.sql.catalyst.util.TypeUtils.ordinalNumber
+import org.apache.spark.sql.types.{DataType, UserDefinedType}
+
+/**
+ * Wrap a column with a UDT whose underlying SQL type matches the column data 
type.
+ *
+ * @see [[UnwrapUDT]] for converting a UDT column to its underlying SQL type.
+ */
+case class WrapUDT(child: Expression, udt: UserDefinedType[_])
+  extends UnaryExpression with NonSQLExpression {
+
+  def this(expressions: Seq[Expression]) = {

Review Comment:
   **Blocking:**
   
   Use a fixed `(Expression, Expression)` constructor so `FunctionRegistry` 
enforces the function's two-argument contract. A `Seq[Expression]` constructor 
selects the variadic builder, so Connect's public `call_udf` path can pass 
extra arguments that are silently ignored; too few arguments fail through 
sequence indexing instead of Spark's standard wrong-arity analysis error.



-- 
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]

Reply via email to