diff --git a/python/pyspark/sql/worker/analyze_udtf.py b/python/pyspark/sql/worker/analyze_udtf.py index fb90129525269..32326bc497af0 100644 --- a/python/pyspark/sql/worker/analyze_udtf.py +++ b/python/pyspark/sql/worker/analyze_udtf.py @@ -140,7 +140,7 @@ def check_method_invariants_before_running( and num_expected_args != num_provided_args ): # The UDTF call provided the wrong number of positional arguments. - def arguments(num): + def arguments(num: int) -> str: return f"{num} argument{'' if num == 1 else 's'}" raise PySparkValueError( @@ -185,11 +185,15 @@ def arguments(num): ) check_method_invariants_before_running( - inspect.getfullargspec(handler.analyze), "static analyze", is_static=True + inspect.getfullargspec(handler.analyze), # type: ignore[attr-defined] + "static analyze", + is_static=True ) if hasattr(handler, "eval"): check_method_invariants_before_running( - inspect.getfullargspec(handler.eval), "eval", is_static=False + inspect.getfullargspec(handler.eval), # type: ignore[attr-defined] + "eval", + is_static=False ) # Invoke the UDTF's 'analyze' method.