You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2025/11/25 23:35:38 UTC

(spark) branch branch-4.1 updated: [SPARK-54482][PYTHON][CONNECT][TESTS] Reeanble `test_apply_in_pandas_returning_column_names_*` for Spark Connect 4.0 client <> master server

This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new 807a6ef07b3d [SPARK-54482][PYTHON][CONNECT][TESTS] Reeanble `test_apply_in_pandas_returning_column_names_*` for Spark Connect 4.0 client <> master server
807a6ef07b3d is described below

commit 807a6ef07b3d34398a4d9be7cae917828f828efa
Author: Ruifeng Zheng <ru...@apache.org>
AuthorDate: Wed Nov 26 08:35:16 2025 +0900

    [SPARK-54482][PYTHON][CONNECT][TESTS] Reeanble `test_apply_in_pandas_returning_column_names_*` for Spark Connect 4.0 client <> master server
    
    ### What changes were proposed in this pull request?
    Fix tests
    
    ### Why are the changes needed?
    to make CI happy
    
    ### Does this PR introduce _any_ user-facing change?
    No, test-only
    
    ### How was this patch tested?
    will monitor the scheduled jobs
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #53209 from zhengruifeng/test_aply_in_pd.
    
    Authored-by: Ruifeng Zheng <ru...@apache.org>
    Signed-off-by: Hyukjin Kwon <gu...@apache.org>
    (cherry picked from commit 27a4849834406a5bbfb0a0b11ea8b725936baef6)
    Signed-off-by: Hyukjin Kwon <gu...@apache.org>
---
 .../sql/tests/pandas/test_pandas_grouped_map.py    | 34 +++++-----------------
 1 file changed, 7 insertions(+), 27 deletions(-)

diff --git a/python/pyspark/sql/tests/pandas/test_pandas_grouped_map.py b/python/pyspark/sql/tests/pandas/test_pandas_grouped_map.py
index f8c646933809..45b18e9414eb 100644
--- a/python/pyspark/sql/tests/pandas/test_pandas_grouped_map.py
+++ b/python/pyspark/sql/tests/pandas/test_pandas_grouped_map.py
@@ -278,37 +278,20 @@ class ApplyInPandasTestsMixin:
         ):
             self._test_apply_in_pandas(lambda key, pdf: key)
 
-    @staticmethod
-    def stats_with_column_names(key, pdf):
-        # order of column can be different to applyInPandas schema when column names are given
-        return pd.DataFrame([(pdf.v.mean(),) + key], columns=["mean", "id"])
-
-    @staticmethod
-    def stats_with_no_column_names(key, pdf):
-        # columns must be in order of applyInPandas schema when no columns given
-        return pd.DataFrame([key + (pdf.v.mean(),)])
-
-    @unittest.skipIf(
-        os.environ.get("SPARK_SKIP_CONNECT_COMPAT_TESTS") == "1", "SPARK-54482: To be reenabled"
-    )
     def test_apply_in_pandas_returning_column_names(self):
-        self._test_apply_in_pandas(ApplyInPandasTestsMixin.stats_with_column_names)
+        self._test_apply_in_pandas(
+            lambda key, pdf: pd.DataFrame([(pdf.v.mean(),) + key], columns=["mean", "id"])
+        )
 
-    @unittest.skipIf(
-        os.environ.get("SPARK_SKIP_CONNECT_COMPAT_TESTS") == "1", "SPARK-54482: To be reenabled"
-    )
     def test_apply_in_pandas_returning_no_column_names(self):
-        self._test_apply_in_pandas(ApplyInPandasTestsMixin.stats_with_no_column_names)
+        self._test_apply_in_pandas(lambda key, pdf: pd.DataFrame([key + (pdf.v.mean(),)]))
 
-    @unittest.skipIf(
-        os.environ.get("SPARK_SKIP_CONNECT_COMPAT_TESTS") == "1", "SPARK-54482: To be reenabled"
-    )
     def test_apply_in_pandas_returning_column_names_sometimes(self):
         def stats(key, pdf):
             if key[0] % 2:
-                return ApplyInPandasTestsMixin.stats_with_column_names(key, pdf)
+                return pd.DataFrame([(pdf.v.mean(),) + key], columns=["mean", "id"])
             else:
-                return ApplyInPandasTestsMixin.stats_with_no_column_names(key, pdf)
+                return pd.DataFrame([key + (pdf.v.mean(),)])
 
         self._test_apply_in_pandas(stats)
 
@@ -886,7 +869,7 @@ class ApplyInPandasTestsMixin:
 
         def stats(key, pdf):
             if key[0] % 2 == 0:
-                return ApplyInPandasTestsMixin.stats_with_no_column_names(key, pdf)
+                return pd.DataFrame([key + (pdf.v.mean(),)])
             return empty_df
 
         result = (
@@ -903,9 +886,6 @@ class ApplyInPandasTestsMixin:
         for row in result:
             self.assertEqual(24.5, row[1])
 
-    @unittest.skipIf(
-        os.environ.get("SPARK_SKIP_CONNECT_COMPAT_TESTS") == "1", "SPARK-54482: To be reenabled"
-    )
     def _test_apply_in_pandas_returning_empty_dataframe_error(self, empty_df, error):
         with self.quiet():
             with self.assertRaisesRegex(PythonException, error):


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