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/19 08:52:49 UTC

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

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


##########
python/pyspark/sql/functions.py:
##########
@@ -3262,18 +3262,49 @@ 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:
-    r"""Replace all substrings of the specified string value that match regexp with rep.
+@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:
   Nit. With the latest changes we can drop overloaded signatures and keep only
   
   ```python
   def regexp_replace(
       string: "ColumnOrName", pattern: Union[str, Column], replacement: Union[str, Column]
   ) -> Column: 
   ```
   
   Otherwise LGTM



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