Kimahriman commented on code in PR #52440:
URL: https://github.com/apache/spark/pull/52440#discussion_r2379436223


##########
python/pyspark/sql/pandas/_typing/__init__.pyi:
##########
@@ -20,6 +20,7 @@ from typing import (
     Any,
     Callable,
     Iterable,
+    Iterator,

Review Comment:
   Hmm that's true, but Iterable seems kinda weird for all of these cases. 
Iterable usually suggests it can be iterated multiple times. Also users _must_ 
use `Iterator` for the type hints to catch it properly, so this is kinda 
misleading. In fact testing out some existing type definitions I get a type 
error if I try to do this:
   
   ```python
   def pandas_iter(iterator: Iterator[pd.Series]) -> Iterator[pd.Series]:
       return iterator
   
   iter_func: PandasScalarIterFunction = pandas_iter
   ```
   
   So I think they all actually need to be updated to `Iterator` instead



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

Reply via email to