You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/06/16 01:20:35 UTC
[GitHub] [spark] Yikun commented on a change in pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based
Yikun commented on a change in pull request #32821:
URL: https://github.com/apache/spark/pull/32821#discussion_r652277828
##########
File path: python/pyspark/pandas/data_type_ops/num_ops.py
##########
@@ -395,3 +400,17 @@ def astype(
return _as_string_type(index_ops, dtype, null_str=str(np.nan))
else:
return _as_other_type(index_ops, dtype, spark_type)
+
+
+class DecimalOps(FractionalOps):
+ """
+ The class for decimal operations of pandas-on-Spark objects with spark type:
+ DecimalType.
+ """
+
+ @property
+ def pretty_name(self) -> str:
+ return "decimal"
+
+ def isnull(self, index_ops: Union["Index", "Series"]) -> Union["Series", "Index"]:
Review comment:
I think this `isnull` is designed for IndexOpsMixin to match the pandas's `isnull` API, so I think maybe it's not a good idea to make this `isnull` to cover col.isnull case.
The problem is that index_ops.spark.column is not datatype-based, if it's just for avoiding duplicated code, maybe we could add some utils function to address it.
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org