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/10/20 02:03:37 UTC

[GitHub] [spark] Yikun commented on a change in pull request #34314: [SPARK-36231][PYTHON] Support arithmetic operations of decimal(nan) series

Yikun commented on a change in pull request #34314:
URL: https://github.com/apache/spark/pull/34314#discussion_r732353478



##########
File path: python/pyspark/pandas/tests/data_type_ops/test_num_ops.py
##########
@@ -344,40 +334,35 @@ def test_from_to_pandas(self):
             self.assert_eq(ps.from_pandas(pser), psser)
 
     def test_isnull(self):
-        pdf, psdf = self.numeric_w_nan_pdf, self.numeric_w_nan_psdf
-        for col in self.numeric_w_nan_df_cols:
+        pdf, psdf = self.pdf, self.psdf
+        for col in self.numeric_df_cols:
             self.assert_eq(pdf[col].isnull(), psdf[col].isnull())
 
     def test_astype(self):
         pdf, psdf = self.pdf, self.psdf
         for col in self.numeric_df_cols:
             pser, psser = pdf[col], psdf[col]
-            self.assert_eq(pser.astype(int), psser.astype(int))
+            if not pser.hasnans:
+                self.assert_eq(pser.astype(int), psser.astype(int))
+                self.assert_eq(pser.astype(np.int32), psser.astype(np.int32))
+                self.assert_eq(pser.astype(np.int16), psser.astype(np.int16))
+                self.assert_eq(pser.astype(np.int8), psser.astype(np.int8))
+                # TODO(SPARK-37039): the np.nan series.astype(bool) should be True
+                self.assert_eq(pser.astype(bool), psser.astype(bool))
+            else:
+                for int_type in [int, np.int32, np.int16, np.int8]:

Review comment:
       Sure, will do it in next commits or followup.

##########
File path: python/pyspark/pandas/tests/data_type_ops/testing_utils.py
##########
@@ -69,25 +75,6 @@ def integral_pdf(self):
     def integral_psdf(self):
         return ps.from_pandas(self.integral_pdf)
 
-    # TODO(SPARK-36031): Merge self.numeric_w_nan_p(s)df into self.numeric_p(s)df

Review comment:
       done, I mentioned "This patch also move numeric_w_nan_pdf into numeric_pdf" before, it's a little bit confused, I append, "that means all float_nan/decimal_nan separated test case have been cleaned up and merged into numeric test."




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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



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