From 8cce3318896125378ed6a8bbc802af47dad9eaa7 Mon Sep 17 00:00:00 2001 From: Yicong-Huang <17627829+Yicong-Huang@users.noreply.github.com> Date: Tue, 4 Aug 2026 19:24:31 +0000 Subject: [PATCH 1/2] test: relax RESULT_ROWS_MISMATCH assertion for cross-version old-client compatibility --- python/pyspark/sql/tests/pandas/test_pandas_udf_scalar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pyspark/sql/tests/pandas/test_pandas_udf_scalar.py b/python/pyspark/sql/tests/pandas/test_pandas_udf_scalar.py index d7af5dd146327..629a8387a9f07 100644 --- a/python/pyspark/sql/tests/pandas/test_pandas_udf_scalar.py +++ b/python/pyspark/sql/tests/pandas/test_pandas_udf_scalar.py @@ -668,7 +668,7 @@ def check_vectorized_udf_invalid_length(self): df = self.spark.range(10) raise_exception = pandas_udf(lambda _: pd.Series(1), LongType()) with self.assertRaisesRegex( - Exception, "Result vector from pandas_udf was not the required length" + Exception, "The number of output rows.*must match the number of input rows" ): df.select(raise_exception(col("id"))).collect() From 8edd7f9cacac0bed73969cc708786cad4da65216 Mon Sep 17 00:00:00 2001 From: Yicong-Huang <17627829+Yicong-Huang@users.noreply.github.com> Date: Tue, 4 Aug 2026 21:41:35 +0000 Subject: [PATCH 2/2] test: also accept branch-4.0 SCHEMA_MISMATCH_FOR_PANDAS_UDF message --- python/pyspark/sql/tests/pandas/test_pandas_udf_scalar.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/pyspark/sql/tests/pandas/test_pandas_udf_scalar.py b/python/pyspark/sql/tests/pandas/test_pandas_udf_scalar.py index 629a8387a9f07..73d74af6b6501 100644 --- a/python/pyspark/sql/tests/pandas/test_pandas_udf_scalar.py +++ b/python/pyspark/sql/tests/pandas/test_pandas_udf_scalar.py @@ -667,8 +667,13 @@ def test_vectorized_udf_invalid_length(self): def check_vectorized_udf_invalid_length(self): df = self.spark.range(10) raise_exception = pandas_udf(lambda _: pd.Series(1), LongType()) + # Accept both this branch's SCHEMA_MISMATCH_FOR_PANDAS_UDF message and the + # RESULT_ROWS_MISMATCH message a newer server raises (SPARK-58529), so the + # cross-version old-client job passes against a master server. with self.assertRaisesRegex( - Exception, "The number of output rows.*must match the number of input rows" + Exception, + "Result vector from pandas_udf was not the required length" + "|The number of output rows.*must match the number of input rows", ): df.select(raise_exception(col("id"))).collect()