itholic commented on code in PR #41514:
URL: https://github.com/apache/spark/pull/41514#discussion_r1227412988
##########
python/pyspark/pandas/data_type_ops/base.py:
##########
@@ -219,6 +219,10 @@ def _is_boolean_type(right: Any) -> bool:
)
+def _is_extension_dtypes(object: Any) -> bool:
Review Comment:
Yeah, basically this function just simply checks whether the given `object`
is an extension dtype or not.
Looking at the changes in the `num_ops.py`, it is necessary to handle binary
operations differently when either the `left` or `right` is an extension dtype.
If this util function doesn't exist, the code:
```python
if isinstance(getattr(left, "dtype", None), extension_dtypes) or
isinstance(getattr(right, "dtype", None), extension_dtypes):
...
```
would have to be added to every function.
So I added this utility function to simplify the code because I believe that
adding such code to every function would compromise the code's readability.
--
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]