duan-n2d commented on PR #60577:
URL: https://github.com/apache/spark/pull/60577#issuecomment-6944826830

   The only failing job in the fork's run is Linters (ruff and ruff format 
pass); all the `pyspark-pandas*` jobs, which run the new tests and doctests, 
are green. The lint failure is three mypy errors in `frame.py`:
   
   ```
   python/pyspark/pandas/frame.py:3921: error: "Index[Any]" has no attribute 
"indexer_between_time"  [attr-defined]
   python/pyspark/pandas/frame.py:3927: error: Incompatible return value type 
(got "Series[Any] | DataFrame[Any]", expected "DataFrame[Any]")  [return-value]
   python/pyspark/pandas/frame.py:4014: error: Incompatible return value type 
(got "Series[Any] | DataFrame[Any]", expected "DataFrame[Any]")  [return-value]
   ```
   
   - 3921: the `isinstance(self.columns, pd.DatetimeIndex)` check is in the 
earlier branch, so mypy doesn't narrow `self.columns` here. `at_time` avoids 
this by binding `columns` first; for `between_time` a cast is the smallest 
change:
   
     ```python
     columns = cast(pd.DatetimeIndex, self.columns)  # checked above
     indexer = columns.indexer_between_time(
     ```
   
   - 3927 and 4014: `iloc[:, ...]` is typed as `Series | DataFrame`. 
`DataFrame.take` casts the same expression, `cast(DataFrame, self.iloc[:, 
indices])`, so:
   
     ```python
     return cast(DataFrame, self.iloc[:, indexer.tolist()])
     ```
   
   I haven't run mypy myself; these follow the casts already used in `take` and 
`_last`/`_first`.


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

Reply via email to