zero323 commented on code in PR #37329:
URL: https://github.com/apache/spark/pull/37329#discussion_r933778937
##########
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:
> The types make it somewhat unclear that pattern and replacement must be
either both strings or both columns to match the signatures
Yeah, I would go with `overload` here as well. We capture these types of
dependencies in other places and I don't see any reason to make type checks
weaker here.
--
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]