zero323 commented on a change in pull request #34354: URL: https://github.com/apache/spark/pull/34354#discussion_r756336353
########## File path: python/pyspark/sql/functions.py ########## @@ -3514,7 +3538,19 @@ def map_from_arrays(col1: "ColumnOrName", col2: "ColumnOrName") -> Column: return Column(sc._jvm.functions.map_from_arrays(_to_java_column(col1), _to_java_column(col2))) +@overload def array(*cols: "ColumnOrName") -> Column: + ... + + +@overload +def array(__cols: Union[List["ColumnOrName"], Tuple["ColumnOrName", ...]]) -> Column: + ... + + +def array( + *cols: Union["ColumnOrName", Union[List["ColumnOrName"], Tuple["ColumnOrName", ...]]] Review comment: In general, nested `Unions` are flattened automatically: ```python >>> Union["ColumnOrName", Union[List["ColumnOrName"], Tuple["ColumnOrName", ...]]] typing.Union[ForwardRef('ColumnOrName'), typing.List[ForwardRef('ColumnOrName')], typing.Tuple[ForwardRef('ColumnOrName'), ... ``` Personally, I find structure that clearly groups similar categories useful (for similar problem see https://github.com/apache/spark/pull/34671#discussion_r754532969), but I am not very attached to this idea. -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org