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/08 12:29:36 UTC

[GitHub] [spark] Yikun opened a new pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Yikun opened a new pull request #32821:
URL: https://github.com/apache/spark/pull/32821


   
   ### What changes were proposed in this pull request?
   Introduce a DecimalOps for DecimalType
   
   
   ### Why are the changes needed?
   In PySpark, DoubleType and FloatType could have NaN, whereas DecimalType not. Now, DecimalType, DoubleType, and FloatType data share the FractionalOps class.
   
   We need to introduce a DecimalOps for DecimalType.
   
   https://issues.apache.org/jira/browse/SPARK-35342
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   - New added DecimalOpsTest passed
   - Existing NumOpsTest passed


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


[GitHub] [spark] SparkQA removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861279903


   **[Test build #139801 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139801/testReport)** for PR 32821 at commit [`bca1d84`](https://github.com/apache/spark/commit/bca1d84b288a166e367ff0785b298808c670b17b).


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858509118


   **[Test build #139634 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139634/testReport)** for PR 32821 at commit [`486c2c4`](https://github.com/apache/spark/commit/486c2c44530ea9dd5e278564c90421073dce2878).


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


[GitHub] [spark] SparkQA removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-859239324


   **[Test build #139678 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139678/testReport)** for PR 32821 at commit [`6b779b7`](https://github.com/apache/spark/commit/6b779b7c12414fef8c844ac6b56cfea66ea93236).


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


[GitHub] [spark] xinrong-databricks edited a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks edited a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856915919


   As the ticket description says, the motivation to introduce DecimalType is that DoubleType and FloatType could have NaN, whereas DecimalType could not.
   Would you consider moving null checks methods to DataTypeOps?
   An example method would be  https://github.com/apache/spark/blob/master/python/pyspark/pandas/base.py#L956 ? @Yikun 
   Thank you!


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


[GitHub] [spark] xinrong-databricks commented on a change in pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks commented on a change in pull request #32821:
URL: https://github.com/apache/spark/pull/32821#discussion_r649365548



##########
File path: python/pyspark/pandas/tests/data_type_ops/test_decimal_ops.py
##########
@@ -0,0 +1,65 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import decimal as d
+
+import numpy as np
+import pandas as pd
+
+from pyspark.pandas.data_type_ops.num_ops import DecimalOps
+from pyspark import pandas as ps
+from pyspark.pandas.tests.data_type_ops.testing_utils import TestCasesUtils
+from pyspark.testing.pandasutils import PandasOnSparkTestCase
+
+
+class DecimalOpsTest(PandasOnSparkTestCase, TestCasesUtils):
+    @property
+    def decimal_pser(self):
+        return pd.Series([d.Decimal(1.0), d.Decimal(2.0), d.Decimal(np.nan)])
+
+    @property
+    def decimal_psser(self):
+        return ps.from_pandas(self.decimal_pser)
+
+    @property
+    def float_pser(self):
+        return pd.Series([1, 2, np.nan], dtype=float)
+
+    @property
+    def float_psser(self):
+        return ps.from_pandas(self.float_pser)
+
+    def test_datatype_ops(self):
+        psser = self.decimal_psser
+        self.assertIsInstance(psser._dtype_op, DecimalOps)
+        self.assertEqual(psser._dtype_op.pretty_name, "decimal")
+
+    def test_isnull(self):
+        deci_psser = self.decimal_psser
+        float_psser = self.float_psser
+
+        self.assertEqual(deci_psser._dtype_op.pretty_name, "decimal")
+        self.assertEqual(float_psser._dtype_op.pretty_name, "fractions")
+
+        self.assert_eq(
+            pd.Series([False, False, False], index=[0, 1, 2]),
+            deci_psser._dtype_op.isnull(deci_psser),
+        )
+        self.assert_eq(
+            pd.Series([False, False, True], index=[0, 1, 2]),
+            float_psser._dtype_op.isnull(float_psser),

Review comment:
       Out of curiosity, why don't we compare with pandas `isnull` here?




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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861401818


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139801/
   


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858768595


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139639/
   


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861401818


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139801/
   


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856799112


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44005/
   


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858316652


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139616/
   


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858553260


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44160/
   


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856769695


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44005/
   


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


[GitHub] [spark] Yikun commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
Yikun commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861131314


   > Would you take care of https://github.com/apache/spark/blob/master/python/pyspark/pandas/data_type_ops/num_ops.py#L386-L389 in your PR as well? Sorry for the conflicts :).
   
   Emm, I prefer to make `astype` move to decimal ops as a sperated PR to make PR simple and easy to review. I'd like to help it. And your idea? : )


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858427341


   **[Test build #139628 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139628/testReport)** for PR 32821 at commit [`4afb09c`](https://github.com/apache/spark/commit/4afb09c5d970696352d0eda72dcf26900be725f1).


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856726332


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139482/
   


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


[GitHub] [spark] Yikun commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
Yikun commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-859239524


   Our goal is `make isnull method data-type-based`, but we should introduce DecimalOps first. Actually, there are 2 tasks in this pr, so I change update the PR title.
   
   If someone think we should split this PR to separted two pr (one for DecimalOps, the other one for isnull), I'd also like to split 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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858376468


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44143/
   


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858424088


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44147/
   


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


[GitHub] [spark] xinrong-databricks commented on a change in pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks commented on a change in pull request #32821:
URL: https://github.com/apache/spark/pull/32821#discussion_r649366854



##########
File path: python/pyspark/pandas/tests/data_type_ops/test_decimal_ops.py
##########
@@ -0,0 +1,65 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import decimal as d
+
+import numpy as np
+import pandas as pd
+
+from pyspark.pandas.data_type_ops.num_ops import DecimalOps
+from pyspark import pandas as ps
+from pyspark.pandas.tests.data_type_ops.testing_utils import TestCasesUtils
+from pyspark.testing.pandasutils import PandasOnSparkTestCase
+
+
+class DecimalOpsTest(PandasOnSparkTestCase, TestCasesUtils):
+    @property
+    def decimal_pser(self):
+        return pd.Series([d.Decimal(1.0), d.Decimal(2.0), d.Decimal(np.nan)])
+
+    @property
+    def decimal_psser(self):
+        return ps.from_pandas(self.decimal_pser)
+
+    @property
+    def float_pser(self):
+        return pd.Series([1, 2, np.nan], dtype=float)
+
+    @property
+    def float_psser(self):
+        return ps.from_pandas(self.float_pser)
+
+    def test_datatype_ops(self):
+        psser = self.decimal_psser
+        self.assertIsInstance(psser._dtype_op, DecimalOps)
+        self.assertEqual(psser._dtype_op.pretty_name, "decimal")
+
+    def test_isnull(self):

Review comment:
       Would you add `test_isnull` for other files under `python/pyspark/pandas/tests/data_type_ops/`?




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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856841306


   **[Test build #139486 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139486/testReport)** for PR 32821 at commit [`a598a48`](https://github.com/apache/spark/commit/a598a48c146db92cd3fe6f087af0ff41af446941).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858454242


   **[Test build #139628 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139628/testReport)** for PR 32821 at commit [`4afb09c`](https://github.com/apache/spark/commit/4afb09c5d970696352d0eda72dcf26900be725f1).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858617650


   Kubernetes integration test status failure
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44160/
   


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


[GitHub] [spark] xinrong-databricks commented on a change in pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks commented on a change in pull request #32821:
URL: https://github.com/apache/spark/pull/32821#discussion_r649357721



##########
File path: python/pyspark/pandas/data_type_ops/num_ops.py
##########
@@ -344,3 +344,20 @@ def rfloordiv(left, right):
 
         right = transform_boolean_operand_to_numeric(right, left.spark.data_type)
         return numpy_column_op(rfloordiv)(left, right)
+
+    def isnull(self, ser):
+        return ser._with_new_scol(ser.spark.column.isNull() | F.isnan(ser.spark.column))
+
+
+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, ser):

Review comment:
       Shall we add type annotations?




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


[GitHub] [spark] xinrong-databricks commented on a change in pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks commented on a change in pull request #32821:
URL: https://github.com/apache/spark/pull/32821#discussion_r649357271



##########
File path: python/pyspark/pandas/data_type_ops/base.py
##########
@@ -206,3 +209,10 @@ def restore(self, col: pd.Series) -> pd.Series:
     def prepare(self, col: pd.Series) -> pd.Series:
         """Prepare column when from_pandas."""
         return col.replace({np.nan: None})
+
+    def isnull(self, element):

Review comment:
       Shall we add type annotations?




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


[GitHub] [spark] SparkQA removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858290656


   **[Test build #139611 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139611/testReport)** for PR 32821 at commit [`b3168ac`](https://github.com/apache/spark/commit/b3168ac30f2d99653ef29fe80e968836ca956fe0).


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


[GitHub] [spark] xinrong-databricks commented on a change in pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
xinrong-databricks commented on a change in pull request #32821:
URL: https://github.com/apache/spark/pull/32821#discussion_r650119142



##########
File path: python/pyspark/pandas/data_type_ops/base.py
##########
@@ -206,3 +209,10 @@ def restore(self, col: pd.Series) -> pd.Series:
     def prepare(self, col: pd.Series) -> pd.Series:
         """Prepare column when from_pandas."""
         return col.replace({np.nan: None})
+
+    def isnull(self, series):

Review comment:
       Shall we add type annotations?

##########
File path: python/pyspark/pandas/data_type_ops/base.py
##########
@@ -206,3 +209,10 @@ def restore(self, col: pd.Series) -> pd.Series:
     def prepare(self, col: pd.Series) -> pd.Series:
         """Prepare column when from_pandas."""
         return col.replace({np.nan: None})
+
+    def isnull(self, series):

Review comment:
       The `series` parameter should be of `Union["Series", "Index"]`(`IndexOpsMixin`) type, shall we rename it more generally, for example, `index_ops`?
   It would be wonderful the parameter type hints can be added as well.

##########
File path: python/pyspark/pandas/data_type_ops/num_ops.py
##########
@@ -344,3 +344,20 @@ def rfloordiv(left, right):
 
         right = transform_boolean_operand_to_numeric(right, left.spark.data_type)
         return numpy_column_op(rfloordiv)(left, right)
+
+    def isnull(self, series) -> Union["Series", "Index"]:
+        return series._with_new_scol(series.spark.column.isNull() | F.isnan(series.spark.column))
+
+
+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, series) -> Union["Series", "Index"]:

Review comment:
       ditto

##########
File path: python/pyspark/pandas/data_type_ops/num_ops.py
##########
@@ -344,3 +344,20 @@ def rfloordiv(left, right):
 
         right = transform_boolean_operand_to_numeric(right, left.spark.data_type)
         return numpy_column_op(rfloordiv)(left, right)
+
+    def isnull(self, series) -> Union["Series", "Index"]:

Review comment:
       ditto




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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-859239324






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


[GitHub] [spark] xinrong-databricks edited a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks edited a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-857848384






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


[GitHub] [spark] xinrong-databricks commented on a change in pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks commented on a change in pull request #32821:
URL: https://github.com/apache/spark/pull/32821#discussion_r649361938



##########
File path: python/pyspark/pandas/tests/data_type_ops/test_decimal_ops.py
##########
@@ -0,0 +1,65 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import decimal as d
+
+import numpy as np
+import pandas as pd
+
+from pyspark.pandas.data_type_ops.num_ops import DecimalOps
+from pyspark import pandas as ps
+from pyspark.pandas.tests.data_type_ops.testing_utils import TestCasesUtils
+from pyspark.testing.pandasutils import PandasOnSparkTestCase
+
+
+class DecimalOpsTest(PandasOnSparkTestCase, TestCasesUtils):
+    @property
+    def decimal_pser(self):
+        return pd.Series([d.Decimal(1.0), d.Decimal(2.0), d.Decimal(np.nan)])
+
+    @property
+    def decimal_psser(self):
+        return ps.from_pandas(self.decimal_pser)
+
+    @property
+    def float_pser(self):
+        return pd.Series([1, 2, np.nan], dtype=float)
+
+    @property
+    def float_psser(self):
+        return ps.from_pandas(self.float_pser)
+
+    def test_datatype_ops(self):
+        psser = self.decimal_psser
+        self.assertIsInstance(psser._dtype_op, DecimalOps)
+        self.assertEqual(psser._dtype_op.pretty_name, "decimal")
+
+    def test_isnull(self):
+        deci_psser = self.decimal_psser
+        float_psser = self.float_psser
+
+        self.assertEqual(deci_psser._dtype_op.pretty_name, "decimal")
+        self.assertEqual(float_psser._dtype_op.pretty_name, "fractions")
+
+        self.assert_eq(
+            pd.Series([False, False, False], index=[0, 1, 2]),
+            deci_psser._dtype_op.isnull(deci_psser),
+        )
+        self.assert_eq(
+            pd.Series([False, False, True], index=[0, 1, 2]),
+            float_psser._dtype_op.isnull(float_psser),

Review comment:
       `float_psser.isnull()`?




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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856726332


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139482/
   


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858402837


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44147/
   


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858350651


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139620/
   


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


[GitHub] [spark] SparkQA removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858509118


   **[Test build #139634 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139634/testReport)** for PR 32821 at commit [`486c2c4`](https://github.com/apache/spark/commit/486c2c44530ea9dd5e278564c90421073dce2878).


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856845363


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44009/
   


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858316242


   **[Test build #139616 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139616/testReport)** for PR 32821 at commit [`e3b1440`](https://github.com/apache/spark/commit/e3b1440e3a0523e8007b927c84851d6609496501).


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858316652


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139616/
   


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861338489


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44328/
   


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


[GitHub] [spark] ueshin commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
ueshin commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-864187846


   Thanks! merging to master.


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


[GitHub] [spark] xinrong-databricks commented on a change in pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks commented on a change in pull request #32821:
URL: https://github.com/apache/spark/pull/32821#discussion_r649358360



##########
File path: python/pyspark/pandas/tests/data_type_ops/test_decimal_ops.py
##########
@@ -0,0 +1,65 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import decimal as d
+
+import numpy as np
+import pandas as pd
+
+from pyspark.pandas.data_type_ops.num_ops import DecimalOps
+from pyspark import pandas as ps
+from pyspark.pandas.tests.data_type_ops.testing_utils import TestCasesUtils
+from pyspark.testing.pandasutils import PandasOnSparkTestCase
+
+
+class DecimalOpsTest(PandasOnSparkTestCase, TestCasesUtils):
+    @property
+    def decimal_pser(self):
+        return pd.Series([d.Decimal(1.0), d.Decimal(2.0), d.Decimal(np.nan)])
+
+    @property
+    def decimal_psser(self):
+        return ps.from_pandas(self.decimal_pser)
+
+    @property
+    def float_pser(self):
+        return pd.Series([1, 2, np.nan], dtype=float)
+
+    @property
+    def float_psser(self):
+        return ps.from_pandas(self.float_pser)
+
+    def test_datatype_ops(self):

Review comment:
       Nice!




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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856725921


   **[Test build #139482 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139482/testReport)** for PR 32821 at commit [`076115c`](https://github.com/apache/spark/commit/076115c0409516809f6faf3a2138fc5931324d41).


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-863925756






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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858626026


   **[Test build #139639 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139639/testReport)** for PR 32821 at commit [`8ab64b9`](https://github.com/apache/spark/commit/8ab64b95eb3bf5b6b33d5b40a41ed5f5e9557bdf).


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861169622


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44320/
   


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


[GitHub] [spark] xinrong-databricks commented on a change in pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
xinrong-databricks commented on a change in pull request #32821:
URL: https://github.com/apache/spark/pull/32821#discussion_r651963338



##########
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:
       A second thought, if `isnull` returns `pyspark.sql.column.Column` (`index_ops.spark.column.isNull() | F.isnan(index_ops.spark.column)` in this case), https://github.com/apache/spark/blob/master/python/pyspark/pandas/data_type_ops/num_ops.py#L386-L389 can leverage `isnull` as well. How do you think about that?




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


[GitHub] [spark] Yikun commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
Yikun commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856723196


   cc @xinrong-databricks 


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856865939






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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858464559


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44155/
   


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856815878


   **[Test build #139486 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139486/testReport)** for PR 32821 at commit [`a598a48`](https://github.com/apache/spark/commit/a598a48c146db92cd3fe6f087af0ff41af446941).


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


[GitHub] [spark] xinrong-databricks commented on a change in pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks commented on a change in pull request #32821:
URL: https://github.com/apache/spark/pull/32821#discussion_r649361578



##########
File path: python/pyspark/pandas/tests/data_type_ops/test_decimal_ops.py
##########
@@ -0,0 +1,65 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import decimal as d
+
+import numpy as np
+import pandas as pd
+
+from pyspark.pandas.data_type_ops.num_ops import DecimalOps
+from pyspark import pandas as ps
+from pyspark.pandas.tests.data_type_ops.testing_utils import TestCasesUtils
+from pyspark.testing.pandasutils import PandasOnSparkTestCase
+
+
+class DecimalOpsTest(PandasOnSparkTestCase, TestCasesUtils):
+    @property
+    def decimal_pser(self):
+        return pd.Series([d.Decimal(1.0), d.Decimal(2.0), d.Decimal(np.nan)])
+
+    @property
+    def decimal_psser(self):
+        return ps.from_pandas(self.decimal_pser)
+
+    @property
+    def float_pser(self):
+        return pd.Series([1, 2, np.nan], dtype=float)
+
+    @property
+    def float_psser(self):
+        return ps.from_pandas(self.float_pser)
+
+    def test_datatype_ops(self):
+        psser = self.decimal_psser
+        self.assertIsInstance(psser._dtype_op, DecimalOps)
+        self.assertEqual(psser._dtype_op.pretty_name, "decimal")
+
+    def test_isnull(self):
+        deci_psser = self.decimal_psser
+        float_psser = self.float_psser
+
+        self.assertEqual(deci_psser._dtype_op.pretty_name, "decimal")
+        self.assertEqual(float_psser._dtype_op.pretty_name, "fractions")
+
+        self.assert_eq(
+            pd.Series([False, False, False], index=[0, 1, 2]),
+            deci_psser._dtype_op.isnull(deci_psser),

Review comment:
       `deci_psser.isnull()`?




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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858316631


   **[Test build #139616 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139616/testReport)** for PR 32821 at commit [`e3b1440`](https://github.com/apache/spark/commit/e3b1440e3a0523e8007b927c84851d6609496501).
    * This patch **fails RAT tests**.
    * This patch merges cleanly.
    * This patch adds no public classes.


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861167578


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44320/
   


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


[GitHub] [spark] xinrong-databricks edited a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks edited a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-857848384


   Certainly.
   
   In the `isnull ` method, https://github.com/apache/spark/blob/master/python/pyspark/pandas/base.py#L987-L990 has data type checks. We aim to remove these data type checks, with the help of DataTypeOps.
   
   We aim to rewrite `isnull` method as below:
   ```py
   def isnull(self) -> Union["Series", "Index"]:
     return self._dtype_op.isnull(self)
   ```
   
   So we might define `isnull` in DataTypeOps, and its subclasses if needed.
   
   Now DecimalType, DoubleType, and FloatType data share the FractionalOps class, but DecimalType behaves differently from FloatType and DoubleType (as https://github.com/apache/spark/blob/master/python/pyspark/pandas/base.py#L987-L990), so we propose to introduce DecimalOps. The behavior difference here is caused by `DecimalType could not have NaN`.
   
   Feel free to adjust the PR description for a better understanding. :)


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858308504


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44139/
   


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861363319


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44328/
   


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


[GitHub] [spark] Yikun commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
Yikun commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-857331260


   > Would you consider moving null checks methods to DataTypeOps?
   
   I thought the Series already has null check method, so I didn't have plan to add null check in Ops.
   
   I am a little confusion about how to make sure `DecimalType could not have Nan` in DataTypeOps. Do you mean we need do strict `null checks` before every method called in **DecimalOps** (like add, sub) to make sure left and right is not Nan? something like
   
   ```python
   def __add__(self, other) -> Union["Series", "Index"]:
       if isinstance(self._dtype_op, DecimalOps]:
           if self.isnan or other.isnan:
               raise ValueError("Decimal left or right shouldn't be Nan")
       return self._dtype_op.add(self, other)
   ```
   That means if we use the decimal type will do pre-check before every decimalops.
   
   So, would you mind to give some more background about end2end case? Thanks!


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858384275


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44143/
   


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


[GitHub] [spark] SparkQA removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856815878


   **[Test build #139486 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139486/testReport)** for PR 32821 at commit [`a598a48`](https://github.com/apache/spark/commit/a598a48c146db92cd3fe6f087af0ff41af446941).


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858290874


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139611/
   


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858350628


   **[Test build #139620 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139620/testReport)** for PR 32821 at commit [`a07b94f`](https://github.com/apache/spark/commit/a07b94ff01ebade9e79709d4438093eac4711c5e).
    * This patch **fails RAT tests**.
    * This patch merges cleanly.
    * This patch adds no public classes.


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


[GitHub] [spark] SparkQA removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858350174


   **[Test build #139620 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139620/testReport)** for PR 32821 at commit [`a07b94f`](https://github.com/apache/spark/commit/a07b94ff01ebade9e79709d4438093eac4711c5e).


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858290656


   **[Test build #139611 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139611/testReport)** for PR 32821 at commit [`b3168ac`](https://github.com/apache/spark/commit/b3168ac30f2d99653ef29fe80e968836ca956fe0).


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


[GitHub] [spark] Yikun commented on a change in pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861312401


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44328/
   


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


[GitHub] [spark] SparkQA removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858427341


   **[Test build #139628 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139628/testReport)** for PR 32821 at commit [`4afb09c`](https://github.com/apache/spark/commit/4afb09c5d970696352d0eda72dcf26900be725f1).


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858384275


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44143/
   


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


[GitHub] [spark] SparkQA removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858316242


   **[Test build #139616 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139616/testReport)** for PR 32821 at commit [`e3b1440`](https://github.com/apache/spark/commit/e3b1440e3a0523e8007b927c84851d6609496501).


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


[GitHub] [spark] xinrong-databricks edited a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks edited a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856915919


   As the ticket description says, the motivation to introduce DecimalType is that DoubleType and FloatType could have NaN, whereas DecimalType could not. And that influences arithmetic operations.
   Would you consider that? @Yikun 
   Thank you!


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856812075


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44005/
   


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856812075


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44005/
   


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858768595


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139639/
   


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


[GitHub] [spark] SparkQA removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861150727


   **[Test build #139794 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139794/testReport)** for PR 32821 at commit [`ee6d00d`](https://github.com/apache/spark/commit/ee6d00dc3ea57b6b2540345e4d4bcc8a119abe8e).


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858350651


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139620/
   


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858624546






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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861151151


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139794/
   


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861398379


   **[Test build #139801 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139801/testReport)** for PR 32821 at commit [`bca1d84`](https://github.com/apache/spark/commit/bca1d84b288a166e367ff0785b298808c670b17b).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


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


[GitHub] [spark] xinrong-databricks commented on a change in pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks commented on a change in pull request #32821:
URL: https://github.com/apache/spark/pull/32821#discussion_r649361578



##########
File path: python/pyspark/pandas/tests/data_type_ops/test_decimal_ops.py
##########
@@ -0,0 +1,65 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import decimal as d
+
+import numpy as np
+import pandas as pd
+
+from pyspark.pandas.data_type_ops.num_ops import DecimalOps
+from pyspark import pandas as ps
+from pyspark.pandas.tests.data_type_ops.testing_utils import TestCasesUtils
+from pyspark.testing.pandasutils import PandasOnSparkTestCase
+
+
+class DecimalOpsTest(PandasOnSparkTestCase, TestCasesUtils):
+    @property
+    def decimal_pser(self):
+        return pd.Series([d.Decimal(1.0), d.Decimal(2.0), d.Decimal(np.nan)])
+
+    @property
+    def decimal_psser(self):
+        return ps.from_pandas(self.decimal_pser)
+
+    @property
+    def float_pser(self):
+        return pd.Series([1, 2, np.nan], dtype=float)
+
+    @property
+    def float_psser(self):
+        return ps.from_pandas(self.float_pser)
+
+    def test_datatype_ops(self):
+        psser = self.decimal_psser
+        self.assertIsInstance(psser._dtype_op, DecimalOps)
+        self.assertEqual(psser._dtype_op.pretty_name, "decimal")
+
+    def test_isnull(self):
+        deci_psser = self.decimal_psser
+        float_psser = self.float_psser
+
+        self.assertEqual(deci_psser._dtype_op.pretty_name, "decimal")
+        self.assertEqual(float_psser._dtype_op.pretty_name, "fractions")
+
+        self.assert_eq(
+            pd.Series([False, False, False], index=[0, 1, 2]),
+            deci_psser._dtype_op.isnull(deci_psser),

Review comment:
       `deci_psser.isnull(deci_psser)`?




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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858753835


   **[Test build #139639 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139639/testReport)** for PR 32821 at commit [`8ab64b9`](https://github.com/apache/spark/commit/8ab64b95eb3bf5b6b33d5b40a41ed5f5e9557bdf).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


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


[GitHub] [spark] ueshin closed pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
ueshin closed pull request #32821:
URL: https://github.com/apache/spark/pull/32821


   


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


[GitHub] [spark] xinrong-databricks commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856915919


   As the ticket description, the motivation to introduce DecimalType is that DoubleType and FloatType could have NaN, whereas DecimalType could not. And that influences arithmetic operations.
   Would you consider that?
   Thank you!


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858351005


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44143/
   


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861151136


   **[Test build #139794 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139794/testReport)** for PR 32821 at commit [`ee6d00d`](https://github.com/apache/spark/commit/ee6d00dc3ea57b6b2540345e4d4bcc8a119abe8e).
    * This patch **fails Python style tests**.
    * This patch merges cleanly.
    * This patch adds the following public classes _(experimental)_:
     * `case class ShuffleMergedDataBlockId(appId: String, shuffleId: Int, reduceId: Int) extends BlockId `
     * `case class ShuffleMergedIndexBlockId(`
     * `case class ShuffleMergedMetaBlockId(`
     * `class KubernetesLocalDiskShuffleDataIO(sparkConf: SparkConf) extends ShuffleDataIO `
     * `class KubernetesLocalDiskShuffleExecutorComponents(sparkConf: SparkConf)`
     * `class ExpressionContainmentOrdering extends Ordering[Expression] `
     * `case class DayTimeIntervalType(startField: Byte, endField: Byte) extends AtomicType `
     * `public class ParquetVectorUpdaterFactory `


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861169622


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44320/
   


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


[GitHub] [spark] xinrong-databricks edited a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks edited a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-857848384


   Certainly. :)
   
   In the `isnull ` method, https://github.com/apache/spark/blob/master/python/pyspark/pandas/base.py#L987-L990 has data type checks. We aim to remove these data type checks, with the help of DataTypeOps.
   
   We aim to rewrite `isnull` method as below:
   ```py
   def isnull(self) -> Union["Series", "Index"]:
     return self._dtype_op.isnull(self)
   ```
   
   So we might define `isnull` in DataTypeOps, and its subclasses if needed.
   
   Now DecimalType, DoubleType, and FloatType data share the FractionalOps class, but DecimalType behaves differently from FloatType and DoubleType (as https://github.com/apache/spark/blob/master/python/pyspark/pandas/base.py#L987-L990), so we propose to introduce DecimalOps. The behavior difference is caused by `DecimalType could not have NaN`.
   


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


[GitHub] [spark] ueshin commented on a change in pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
ueshin commented on a change in pull request #32821:
URL: https://github.com/apache/spark/pull/32821#discussion_r654013813



##########
File path: python/pyspark/pandas/data_type_ops/base.py
##########
@@ -300,6 +303,13 @@ def prepare(self, col: pd.Series) -> pd.Series:
         """Prepare column when from_pandas."""
         return col.replace({np.nan: None})
 
+    def isnull(self, index_ops: Union["Index", "Series"]) -> Union["Series", "Index"]:
+        from pyspark.pandas.indexes import MultiIndex
+
+        if isinstance(index_ops, MultiIndex):
+            raise NotImplementedError("isna is not defined for MultiIndex")

Review comment:
       Shall we move this back to `base.py`?
   I feel checking whether it's `MultiIndex` or not weird because the layer is a different between dtype and spark_type vs. MultiIndex.

##########
File path: python/pyspark/pandas/data_type_ops/base.py
##########
@@ -300,6 +303,13 @@ def prepare(self, col: pd.Series) -> pd.Series:
         """Prepare column when from_pandas."""
         return col.replace({np.nan: None})
 
+    def isnull(self, index_ops: Union["Index", "Series"]) -> Union["Series", "Index"]:
+        from pyspark.pandas.indexes import MultiIndex
+
+        if isinstance(index_ops, MultiIndex):
+            raise NotImplementedError("isna is not defined for MultiIndex")
+        return index_ops._with_new_scol(index_ops.spark.column.isNull())

Review comment:
       Could you also take care of `field`?
   `field` must contains `dataType=BooleanType(), nullable=False`. e.g.,
   
   ```py
   return index_ops._with_new_scol(
       index_ops.spark.column.isNull(),
       field=index_ops._internal.data_fields[0].copy(spark_type=BooleanType(), nullable=False)
   )
   ```

##########
File path: python/pyspark/pandas/data_type_ops/base.py
##########
@@ -300,6 +303,13 @@ def prepare(self, col: pd.Series) -> pd.Series:
         """Prepare column when from_pandas."""
         return col.replace({np.nan: None})
 
+    def isnull(self, index_ops: Union["Index", "Series"]) -> Union["Series", "Index"]:
+        from pyspark.pandas.indexes import MultiIndex
+
+        if isinstance(index_ops, MultiIndex):
+            raise NotImplementedError("isna is not defined for MultiIndex")

Review comment:
       Shall we move this back to `base.py`?
   I feel checking whether it's `MultiIndex` or not here is weird because the layer is a different between dtype and spark_type vs. MultiIndex.

##########
File path: python/pyspark/pandas/data_type_ops/base.py
##########
@@ -300,6 +303,13 @@ def prepare(self, col: pd.Series) -> pd.Series:
         """Prepare column when from_pandas."""
         return col.replace({np.nan: None})
 
+    def isnull(self, index_ops: Union["Index", "Series"]) -> Union["Series", "Index"]:
+        from pyspark.pandas.indexes import MultiIndex
+
+        if isinstance(index_ops, MultiIndex):
+            raise NotImplementedError("isna is not defined for MultiIndex")
+        return index_ops._with_new_scol(index_ops.spark.column.isNull())

Review comment:
       Ah, I see. I'll take a look later. Thanks.




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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858672341


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44167/
   


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


[GitHub] [spark] xinrong-databricks commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-857848384


   Certainly. :)
   
   In the `isnull ` method, https://github.com/apache/spark/blob/master/python/pyspark/pandas/base.py#L987-L990 has data type checks. We aim to remove these data type checks, with the help of DataTypeOps.
   
   We aim to rewrite `isnull` method as below:
   ```py
   def isnull(self) -> Union["Series", "Index"]:
     self._dtype_op.isnull(self)
   ```
   
   So we might define `isnull` in DataTypeOps, and its subclasses if needed.
   
   Now DecimalType, DoubleType, and FloatType data share the FractionalOps class, but DecimalType behaves differently from FloatType and DoubleType (as https://github.com/apache/spark/blob/master/python/pyspark/pandas/base.py#L987-L990), so we propose to introduce DecimalOps. The behavior difference is caused by `DecimalType could not have NaN`.
   


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


[GitHub] [spark] xinrong-databricks edited a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks edited a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856915919


   As the ticket description says, the motivation to introduce DecimalType is that DoubleType and FloatType could have NaN, whereas DecimalType could not. And that should be reflected in the arithmetic operations, more specifically, introducing NaN checks for DecimalType.
   Would you consider that? @Yikun 
   Thank you!


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858661967


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44167/
   


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858380944


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44147/
   


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861150727


   **[Test build #139794 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139794/testReport)** for PR 32821 at commit [`ee6d00d`](https://github.com/apache/spark/commit/ee6d00dc3ea57b6b2540345e4d4bcc8a119abe8e).


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-863925756






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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858616035


   **[Test build #139634 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139634/testReport)** for PR 32821 at commit [`486c2c4`](https://github.com/apache/spark/commit/486c2c44530ea9dd5e278564c90421073dce2878).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


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


[GitHub] [spark] xinrong-databricks commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856916729


   CC @ueshin @HyukjinKwon @itholic 


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858672341


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44167/
   


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858624549






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


[GitHub] [spark] Yikun commented on a change in pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
Yikun commented on a change in pull request #32821:
URL: https://github.com/apache/spark/pull/32821#discussion_r649663634



##########
File path: python/pyspark/pandas/tests/data_type_ops/test_decimal_ops.py
##########
@@ -0,0 +1,65 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import decimal as d
+
+import numpy as np
+import pandas as pd
+
+from pyspark.pandas.data_type_ops.num_ops import DecimalOps
+from pyspark import pandas as ps
+from pyspark.pandas.tests.data_type_ops.testing_utils import TestCasesUtils
+from pyspark.testing.pandasutils import PandasOnSparkTestCase
+
+
+class DecimalOpsTest(PandasOnSparkTestCase, TestCasesUtils):
+    @property
+    def decimal_pser(self):
+        return pd.Series([d.Decimal(1.0), d.Decimal(2.0), d.Decimal(np.nan)])
+
+    @property
+    def decimal_psser(self):
+        return ps.from_pandas(self.decimal_pser)
+
+    @property
+    def float_pser(self):
+        return pd.Series([1, 2, np.nan], dtype=float)
+
+    @property
+    def float_psser(self):
+        return ps.from_pandas(self.float_pser)
+
+    def test_datatype_ops(self):
+        psser = self.decimal_psser
+        self.assertIsInstance(psser._dtype_op, DecimalOps)
+        self.assertEqual(psser._dtype_op.pretty_name, "decimal")
+
+    def test_isnull(self):

Review comment:
       Yep

##########
File path: python/pyspark/pandas/tests/data_type_ops/test_decimal_ops.py
##########
@@ -0,0 +1,65 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import decimal as d
+
+import numpy as np
+import pandas as pd
+
+from pyspark.pandas.data_type_ops.num_ops import DecimalOps
+from pyspark import pandas as ps
+from pyspark.pandas.tests.data_type_ops.testing_utils import TestCasesUtils
+from pyspark.testing.pandasutils import PandasOnSparkTestCase
+
+
+class DecimalOpsTest(PandasOnSparkTestCase, TestCasesUtils):
+    @property
+    def decimal_pser(self):
+        return pd.Series([d.Decimal(1.0), d.Decimal(2.0), d.Decimal(np.nan)])
+
+    @property
+    def decimal_psser(self):
+        return ps.from_pandas(self.decimal_pser)
+
+    @property
+    def float_pser(self):
+        return pd.Series([1, 2, np.nan], dtype=float)
+
+    @property
+    def float_psser(self):
+        return ps.from_pandas(self.float_pser)
+
+    def test_datatype_ops(self):
+        psser = self.decimal_psser
+        self.assertIsInstance(psser._dtype_op, DecimalOps)
+        self.assertEqual(psser._dtype_op.pretty_name, "decimal")
+
+    def test_isnull(self):
+        deci_psser = self.decimal_psser
+        float_psser = self.float_psser
+
+        self.assertEqual(deci_psser._dtype_op.pretty_name, "decimal")
+        self.assertEqual(float_psser._dtype_op.pretty_name, "fractions")
+
+        self.assert_eq(
+            pd.Series([False, False, False], index=[0, 1, 2]),
+            deci_psser._dtype_op.isnull(deci_psser),

Review comment:
       Good suggestion.

##########
File path: python/pyspark/pandas/data_type_ops/base.py
##########
@@ -206,3 +209,10 @@ def restore(self, col: pd.Series) -> pd.Series:
     def prepare(self, col: pd.Series) -> pd.Series:
         """Prepare column when from_pandas."""
         return col.replace({np.nan: None})
+
+    def isnull(self, element):

Review comment:
       Sure, it would be:
   `def isnull(self, series) -> Union["Series", "Index"]:`

##########
File path: python/pyspark/pandas/tests/data_type_ops/test_decimal_ops.py
##########
@@ -0,0 +1,65 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import decimal as d
+
+import numpy as np
+import pandas as pd
+
+from pyspark.pandas.data_type_ops.num_ops import DecimalOps
+from pyspark import pandas as ps
+from pyspark.pandas.tests.data_type_ops.testing_utils import TestCasesUtils
+from pyspark.testing.pandasutils import PandasOnSparkTestCase
+
+
+class DecimalOpsTest(PandasOnSparkTestCase, TestCasesUtils):
+    @property
+    def decimal_pser(self):
+        return pd.Series([d.Decimal(1.0), d.Decimal(2.0), d.Decimal(np.nan)])
+
+    @property
+    def decimal_psser(self):
+        return ps.from_pandas(self.decimal_pser)
+
+    @property
+    def float_pser(self):
+        return pd.Series([1, 2, np.nan], dtype=float)
+
+    @property
+    def float_psser(self):
+        return ps.from_pandas(self.float_pser)
+
+    def test_datatype_ops(self):
+        psser = self.decimal_psser
+        self.assertIsInstance(psser._dtype_op, DecimalOps)
+        self.assertEqual(psser._dtype_op.pretty_name, "decimal")
+
+    def test_isnull(self):
+        deci_psser = self.decimal_psser
+        float_psser = self.float_psser
+
+        self.assertEqual(deci_psser._dtype_op.pretty_name, "decimal")
+        self.assertEqual(float_psser._dtype_op.pretty_name, "fractions")
+
+        self.assert_eq(
+            pd.Series([False, False, False], index=[0, 1, 2]),
+            deci_psser._dtype_op.isnull(deci_psser),
+        )
+        self.assert_eq(
+            pd.Series([False, False, True], index=[0, 1, 2]),
+            float_psser._dtype_op.isnull(float_psser),

Review comment:
       It just because I didn't realize we can use pandas.isnull result directly. : ), will fix in next patch




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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858290866


   **[Test build #139611 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139611/testReport)** for PR 32821 at commit [`b3168ac`](https://github.com/apache/spark/commit/b3168ac30f2d99653ef29fe80e968836ca956fe0).
    * This patch **fails RAT tests**.
    * This patch merges cleanly.
    * This patch adds no public classes.


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861363319


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44328/
   


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861151151


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139794/
   


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


[GitHub] [spark] xinrong-databricks edited a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
xinrong-databricks edited a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856915919


   As the ticket description says, the motivation to introduce DecimalType is that DoubleType and FloatType could have NaN, whereas DecimalType could not. And that influences arithmetic operations.
   Would you consider that?
   Thank you!


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


[GitHub] [spark] SparkQA removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-863851709


   **[Test build #139980 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139980/testReport)** for PR 32821 at commit [`d14d825`](https://github.com/apache/spark/commit/d14d8252f2bfc12e5a1314d24eff42b7978a8f8c).


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


[GitHub] [spark] xinrong-databricks commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
xinrong-databricks commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861119905


   Would you take care of https://github.com/apache/spark/blob/master/python/pyspark/pandas/data_type_ops/num_ops.py#L386-L389 in your PR as well? Sorry for the conflicts :).


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


[GitHub] [spark] Yikun commented on a change in pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
Yikun commented on a change in pull request #32821:
URL: https://github.com/apache/spark/pull/32821#discussion_r654208604



##########
File path: python/pyspark/pandas/data_type_ops/base.py
##########
@@ -300,6 +303,13 @@ def prepare(self, col: pd.Series) -> pd.Series:
         """Prepare column when from_pandas."""
         return col.replace({np.nan: None})
 
+    def isnull(self, index_ops: Union["Index", "Series"]) -> Union["Series", "Index"]:
+        from pyspark.pandas.indexes import MultiIndex
+
+        if isinstance(index_ops, MultiIndex):
+            raise NotImplementedError("isna is not defined for MultiIndex")
+        return index_ops._with_new_scol(index_ops.spark.column.isNull())

Review comment:
       Emm, it fails on [BooleanExtensionOpsTest.test_isnull](https://github.com/apache/spark/pull/32821/files/bca1d84b288a166e367ff0785b298808c670b17b#diff-6beed41b484721fbc29caef1b12028fb7808d36d7a2ce5d4e938b0d5c3f81f2dR600-R602) with dtype mismatch:
   
   ```
   Left(pser):
   0    False
   1    False
   2     True
   dtype: bool
   bool
   
   Right(psser):
   0    False
   1    False
   2     True
   dtype: boolean
   boolean
   ```
   
   But if we don't specify the field, it works. Looks like we should just keep it with the default field.




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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856865939






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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858350174


   **[Test build #139620 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139620/testReport)** for PR 32821 at commit [`a07b94f`](https://github.com/apache/spark/commit/a07b94ff01ebade9e79709d4438093eac4711c5e).


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


[GitHub] [spark] SparkQA removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856725921


   **[Test build #139482 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139482/testReport)** for PR 32821 at commit [`076115c`](https://github.com/apache/spark/commit/076115c0409516809f6faf3a2138fc5931324d41).


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858314559


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44139/
   


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858314559


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44139/
   


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


[GitHub] [spark] Yikun edited a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
Yikun edited a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-857331260


   > Would you consider moving null checks methods to DataTypeOps?
   
   @xinrong-databricks  I thought the Series already has null check method, so I didn't have plan to add null check in Ops.
   
   I am a little confusion about how to make sure `DecimalType could not have Nan` in DataTypeOps. Do you mean we need do strict `null checks` before every method called in **DecimalOps** (like add, sub) to make sure left and right is not Nan? something like
   
   ```python
   def __add__(self, other) -> Union["Series", "Index"]:
       if isinstance(self._dtype_op, DecimalOps]:
           if self.isnan or other.isnan:
               raise ValueError("Decimal left or right shouldn't be Nan")
       return self._dtype_op.add(self, other)
   ```
   That means if we use the decimal type will do pre-check before every decimalops.
   
   So, would you mind to give some more background about end2end case? Thanks!


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-859284671






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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-856726312


   **[Test build #139482 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139482/testReport)** for PR 32821 at commit [`076115c`](https://github.com/apache/spark/commit/076115c0409516809f6faf3a2138fc5931324d41).
    * This patch **fails RAT tests**.
    * This patch merges cleanly.
    * This patch adds the following public classes _(experimental)_:
     * `class DecimalOps(FractionalOps):`


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858466240






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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858424088


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44147/
   


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


[GitHub] [spark] SparkQA removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858626026


   **[Test build #139639 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139639/testReport)** for PR 32821 at commit [`8ab64b9`](https://github.com/apache/spark/commit/8ab64b95eb3bf5b6b33d5b40a41ed5f5e9557bdf).


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


[GitHub] [spark] AmplabJenkins commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-859284671






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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858290874


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139611/
   


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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-861279903


   **[Test build #139801 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139801/testReport)** for PR 32821 at commit [`bca1d84`](https://github.com/apache/spark/commit/bca1d84b288a166e367ff0785b298808c670b17b).


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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-858466240






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


[GitHub] [spark] SparkQA commented on pull request #32821: [SPARK-35342][PYTHON] Introduce DecimalOps and make `isnull` method data-type-based

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32821:
URL: https://github.com/apache/spark/pull/32821#issuecomment-863851709






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