You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "dtenedor (via GitHub)" <gi...@apache.org> on 2023/07/26 18:36:26 UTC

[GitHub] [spark] dtenedor commented on a diff in pull request #42157: [SPARK-43968][PYTHON] Improve error messages for Python UDTFs with wrong number of outputs

dtenedor commented on code in PR #42157:
URL: https://github.com/apache/spark/pull/42157#discussion_r1275350920


##########
python/pyspark/sql/tests/test_udtf.py:
##########
@@ -256,29 +254,76 @@ def eval(self, a: int):
         ):
             TestUDTF(lit(1), lit(2)).collect()
 
+    def test_udtf_init_with_additional_args(self):
+        @udtf(returnType="x int")
+        class TestUDTF:
+            def __init__(self, a: int):
+                ...
+
+            def eval(self, a: int):
+                yield a,
+
+        with self.assertRaisesRegex(
+            PythonException, r"__init__\(\) missing 1 required positional argument: 'a'"

Review Comment:
   I mentioned this in @ueshin's previous PR, it would be helpful to include the UDTF name in the error message. Is it possible to add that now, or should we separate that work to a later PR?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org