viirya commented on a change in pull request #24121:
[SPARK-26979][PYTHON][FOLLOW-UP] Make binary math/string functions take string
as columns as well
URL: https://github.com/apache/spark/pull/24121#discussion_r266763523
##########
File path: python/pyspark/sql/functions.py
##########
@@ -71,9 +81,23 @@ def _create_binary_mathfunction(name, doc=""):
""" Create a binary mathfunction by name"""
def _(col1, col2):
sc = SparkContext._active_spark_context
- # users might write ints for simplicity. This would throw an error on
the JVM side.
- jc = getattr(sc._jvm.functions, name)(col1._jc if isinstance(col1,
Column) else float(col1),
- col2._jc if isinstance(col2,
Column) else float(col2))
+ # For legacy reasons, the arguments here can be implicitly converted
into floats,
+ # if they are not columns.
Review comment:
`if they are not columns or strings?`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]