ueshin commented on code in PR #41948:
URL: https://github.com/apache/spark/pull/41948#discussion_r1264266121
##########
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:
Discussed offline and so far we don't support non-`@staticmethod` analyze,
to avoid confusion for a case like:
```py
class MyUDTF:
def analyze(self, a):
self.some_boolean_value = ...
return StructType(...)
def eval(self, a):
if self.some_boolean_value:
yield a + self._foo
```
The instances between `analyze` and `eval` will be different, so it worn't
work as expected.
--
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]