zero323 commented on a change in pull request #34354:
URL: https://github.com/apache/spark/pull/34354#discussion_r734823494
##########
File path: python/pyspark/sql/functions.py
##########
@@ -1652,7 +1652,19 @@ def expr(str: str) -> Column:
return Column(sc._jvm.functions.expr(str))
+@overload
def struct(*cols: "ColumnOrName") -> Column:
+ ...
+
+
+@overload
+def struct(__cols: Union[List["ColumnOrName"], Tuple["ColumnOrName", ...]]) ->
Column:
Review comment:
> How about using more general type, like `Sequence` or `Iterable`?
Yeah, this is something that has bothering me for a couple of days now.
More general type would be great (assuming we'd modify the code, what wouldn't
be a bad idea anyway), if it wasn't for the fact, that `str` is recursively
`Sequence[str] ` / `Iterable[str]`.
```python
from typing import Sequence, Iterable
x: Sequence[str] = "abc"
y: Iterable[str] = "abc"
```
I know it backfires in some contexts, but maybe not 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]