itholic commented on code in PR #40722:
URL: https://github.com/apache/spark/pull/40722#discussion_r1168273396


##########
python/pyspark/pandas/indexing.py:
##########
@@ -1807,7 +1837,13 @@ def _select_cols_else(
             )
 
     def __setitem__(self, key: Any, value: Any) -> None:
-        if not isinstance(value, (Column, ConnectColumn)) and 
is_list_like(value):
+        if is_remote():
+            from pyspark.sql.connect.column import Column as ConnectColumn
+
+            Column = ConnectColumn
+        else:
+            Column = PySparkColumn  # type: ignore[assignment]
+        if not isinstance(value, Column) and is_list_like(value):

Review Comment:
   If we remove `isinstance(value, Column)` then `is_list_like(value)` raise 
`PySparkValueError` when the value is `Column` as below ??
   
   e.g.
   ```python
   >>> is_list_like(scol)
   Traceback (most recent call last):
   ...
   pyspark.errors.exceptions.base.PySparkValueError: 
[CANNOT_CONVERT_COLUMN_INTO_BOOL] Cannot convert column into bool: please use 
'&' for 'and', '|' for 'or', '~' for 'not' when building DataFrame boolean 
expressions.
   ```
   



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