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


##########
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:
   Technically speaking we could also default to invoking `(Column, Column) -> 
Column` and convert arguments accordingly, i.e.
   
   ```python
        return _invoke_function(
               "regexp_replace",
               _to_java_column(string),
               _create_column_from_literal(pattern) if isinstance(pattern, str) 
else _to_java_column(pattern),
               _create_column_from_literal(replacement) if 
isinstance(replacement, str) else _to_java_column(replacement),
           )
   ```



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

Reply via email to