You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/08/01 13:41:46 UTC

[GitHub] [spark] physinet commented on a diff in pull request #37329: [SPARK-39832][PYTHON] Support column arguments in regexp_replace

physinet commented on code in PR #37329:
URL: https://github.com/apache/spark/pull/37329#discussion_r934545923


##########
python/pyspark/sql/functions.py:
##########
@@ -3262,7 +3262,19 @@ def regexp_extract(str: "ColumnOrName", pattern: str, idx: int) -> Column:
     return _invoke_function("regexp_extract", _to_java_column(str), pattern, idx)
 
 
-def regexp_replace(str: "ColumnOrName", pattern: str, replacement: str) -> Column:
+@overload
+def regexp_replace(string: "ColumnOrName", pattern: str, replacement: str) -> Column:
+    ...
+
+
+@overload
+def regexp_replace(string: "ColumnOrName", pattern: Column, replacement: Column) -> Column:
+    ...
+
+
+def regexp_replace(
+    string: "ColumnOrName", pattern: Union[str, Column], replacement: Union[str, Column]

Review Comment:
   Great ideas. I implemented these in [https://github.com/apache/spark/pull/37329/commits/0bdd92bd07b4d5661049f594bf34d0595ab019c4](0bdd92b). Black formatting pushed the if-else statements onto three lines, which I thought was less readable. I changed the formatting a bit to help with readability.



-- 
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