skanderboudawara commented on code in PR #49326:
URL: https://github.com/apache/spark/pull/49326#discussion_r1898882047
##########
python/pyspark/sql/connect/functions/builtin.py:
##########
@@ -339,10 +339,10 @@ def coalesce(*cols: "ColumnOrName") -> Column:
coalesce.__doc__ = pysparkfuncs.coalesce.__doc__
-def expr(str: str) -> Column:
+def expr(expression: str) -> Column:
Review Comment:
Shall I add to keep both versions?
```
@overload
def expr(str: str) -> Column: …
```
Or else I create a decorator for future releases like so
```
from functools import wraps
def deprecated_param(old_param: str, new_param: str):
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
if old_param in kwargs:
import warnings
warnings.warn(f"'{old_param}' is deprecated, use
'{new_param}' instead", DeprecationWarning)
kwargs[new_param] = kwargs.pop(old_param)
return func(*args, **kwargs)
return wrapper
return decorator
@deprecated_param("str", "expression")
def expr(expression: str): ...
```
what do you think?
--
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]