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


##########
sql/api/src/main/scala/org/apache/spark/sql/functions.scala:
##########
@@ -17723,6 +17723,32 @@ object functions {
    */
   def unwrap_udt(column: Column): Column = Column.internalFn("unwrap_udt", 
column)
 
+  /**
+   * Wrap a column as a user-defined type.
+   * @param column
+   *   the column to wrap. The column data type must match the UDT's 
underlying SQL type.
+   * @param udt
+   *   the target user-defined type.
+   * @group udf_funcs
+   * @since 4.4.0
+   */
+  def wrap_udt(column: Column, udt: UserDefinedType[_]): Column = {
+    wrap_udt(column, lit(udt.json))
+  }
+
+  /**
+   * Wrap a column as a user-defined type.
+   * @param column
+   *   the column to wrap. The column data type must match the UDT's 
underlying SQL type.
+   * @param udt
+   *   the target user-defined type as a constant JSON string column.
+   * @group udf_funcs
+   * @since 4.4.0
+   */
+  def wrap_udt(column: Column, udt: Column): Column = {

Review Comment:
   **Non-blocking:**
   
   Could we rename this parameter to `udtJson` or `udtJsonColumn`? Unlike the 
other overload, this `Column` carries the constant JSON type descriptor rather 
than a UDT value, and the current name makes that distinction easy to miss for 
named-argument callers.



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