You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "HyukjinKwon (via GitHub)" <gi...@apache.org> on 2023/09/07 01:26:16 UTC

[GitHub] [spark] HyukjinKwon commented on a diff in pull request #42828: [SPARK-45088][PYTHON][CONNECT] Make `getitem` work with duplicated columns

HyukjinKwon commented on code in PR #42828:
URL: https://github.com/apache/spark/pull/42828#discussion_r1317985272


##########
python/pyspark/sql/dataframe.py:
##########
@@ -3455,8 +3455,14 @@ def __getitem__(self, item: Union[int, str, Column, List, Tuple]) -> Union[Colum
             return self.filter(item)
         elif isinstance(item, (list, tuple)):
             return self.select(*item)
-        elif isinstance(item, int):
-            jc = self._jdf.apply(self.columns[item])
+        elif isinstance(item, int) and not isinstance(item, bool):

Review Comment:
   Allowing `bool` is fine since `bool` inherits `int` in Python.



-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org