allisonwang-db commented on code in PR #41948:
URL: https://github.com/apache/spark/pull/41948#discussion_r1264218509
##########
python/pyspark/errors/error_classes.py:
##########
@@ -277,6 +277,11 @@
"The UDTF '<name>' is invalid. It does not implement the required 'eval'
method. Please implement the 'eval' method in '<name>' and try again."
]
},
+ "INVALID_UDTF_RETURN_TYPE" : {
Review Comment:
I have the same error class defined here:
https://github.com/apache/spark/pull/41989/files#diff-2823e146fc0e6bddff3505b5bee6e2b855782d9f71e900e6f9099fc97d1fffa6R280.
I will change the error class name in my PR.
##########
python/pyspark/sql/udtf.py:
##########
@@ -103,6 +104,14 @@ class VectorizedUDTF:
def __init__(self) -> None:
self.func = cls()
+ if hasattr(cls, "analyze") and isinstance(
+ inspect.getattr_static(cls, "analyze"), staticmethod
+ ):
+
+ @staticmethod
Review Comment:
Why do we make `analyze` a `staticmethod`?
For example, we could have a UDTF defined in this way:
```
class MyUDTF:
def __init__(self):
self.some_boolean_value = ...
def analyze(self, a, b):
if self.some_boolean_value:
return StructType(..)
...
```
--
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]