Yikun commented on a change in pull request #35236:
URL: https://github.com/apache/spark/pull/35236#discussion_r787315973
##########
File path: python/pyspark/pandas/typedef/typehints.py
##########
@@ -559,6 +559,9 @@ def infer_return_type(f: Callable) -> Union[SeriesType,
DataFrameType, ScalarTyp
tpe = get_type_hints(f).get("return", None)
+ if tpe is None:
+ raise TypeError("A return value is required for the input function")
Review comment:
Technically, I think it [should be
ValueError](https://docs.python.org/3/library/exceptions.html#TypeError),
because func is `Callable` but the value is not not meet the requirement. See
also in why raise TypeError before (it just because some compatiable reason):
https://github.com/python/cpython/blob/7c0914d35eaaab2f323260ba5fe8884732533888/Lib/inspect.py#L1374-L1379
It's not a strong prefer for me, just a reminder, you could do a double
check on this, if you have other idea on this, I'm ok with this.
--
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]