zhengruifeng commented on code in PR #46300:
URL: https://github.com/apache/spark/pull/46300#discussion_r1584596015


##########
python/pyspark/sql/connect/udf.py:
##########
@@ -148,15 +150,35 @@ def __init__(
             )
 
         self.func = func
-        self.returnType: DataType = (
-            UnparsedDataType(returnType) if isinstance(returnType, str) else 
returnType
-        )
+        self._returnType = returnType
+        self._returnType_placeholder: Optional[DataType] = None
         self._name = name or (
             func.__name__ if hasattr(func, "__name__") else 
func.__class__.__name__
         )
         self.evalType = evalType
         self.deterministic = deterministic
 
+    @property
+    def returnType(self) -> DataType:

Review Comment:
   in Spark Classic, it assume `this is called after SparkContext is 
initialized`.
   I am not sure whether we can make similar assumptions here.
   
   In 
https://github.com/apache/spark/commit/c0b1735c0bfeb1ff645d146e262d7ccd036a590e,
 it is by design to delays parsing DDL string.



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