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..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, "Result vector from pandas_udf was not the required length" + 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()