zero323 commented on code in PR #37748:
URL: https://github.com/apache/spark/pull/37748#discussion_r960525054
##########
python/pyspark/sql/functions.py:
##########
@@ -108,12 +108,13 @@ def _invoke_binary_math_function(name: str, col1: Any,
col2: Any) -> Column:
Invokes binary JVM math function identified by name
and wraps the result with :class:`~pyspark.sql.Column`.
"""
+
+ def align_type(c: Any) -> Union[str, Column]:
+ # For legacy reasons, the arguments here can be implicitly converted
into column
+ return c if isinstance(c, (str, Column)) else lit(c)
Review Comment:
Unless we plan to reuse this in the future, I'd make more senses to just
inline the expression.
If we do plan to reuse it, this should be marked as internal (`align_type`
-> `_align_type`) and moved next to other helper functions (also, a docstring
would be a good idea).
--
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]