ueshin commented on a change in pull request #32738:
URL: https://github.com/apache/spark/pull/32738#discussion_r646862666
##########
File path: python/pyspark/pandas/indexing.py
##########
@@ -685,13 +691,15 @@ def __setitem__(self, key, value):
return
cond, limit, remaining_index = self._select_rows(rows_sel)
- missing_keys = []
+ missing_keys = [] # type: Optional[List[Tuple]]
_, data_spark_columns, _, _, _ = self._select_cols(cols_sel,
missing_keys=missing_keys)
if cond is None:
cond = F.lit(True)
if limit is not None:
- cond = cond & (self._internal.spark_frame[self._sequence_col]
< F.lit(limit))
+ cond = cond & (
+ self._internal.
+ spark_frame[self._sequence_col] < F.lit(limit)) # type:
ignore
Review comment:
ditto.
##########
File path: python/pyspark/pandas/indexing.py
##########
@@ -656,16 +658,20 @@ def __setitem__(self, key, value):
and (isinstance(self, iLocIndexer) or not same_anchor(value,
self._psdf_or_psser))
):
psdf = self._psdf_or_psser.copy()
Review comment:
We can use `cast` for `psdf`, then we can remove `ignore` in the
following lines.
##########
File path: python/pyspark/pandas/indexing.py
##########
@@ -61,7 +61,7 @@
class IndexerLike(object):
- def __init__(self, psdf_or_psser):
+ def __init__(self, psdf_or_psser: Union["Series", "DataFrame"]) -> None:
Review comment:
nit: we don't need `-> None` for `__init__`.
##########
File path: python/pyspark/pandas/indexing.py
##########
@@ -608,7 +608,9 @@ def __setitem__(self, key, value):
if cond is None:
cond = F.lit(True)
if limit is not None:
- cond = cond & (self._internal.spark_frame[self._sequence_col]
< F.lit(limit))
+ cond = cond & (
+ self._internal.
+ spark_frame[self._sequence_col] < F.lit(limit)) # type:
ignore
Review comment:
Here `self` must always be `iLocIndexer` so you can use `cast`.
`cast(iLocIndexer, self)._sequence_col`
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]