Yicong Huang created SPARK-58529:
------------------------------------

             Summary: Unify RESULT_ROWS_MISMATCH message and consolidate row 
count verification in worker.py
                 Key: SPARK-58529
                 URL: https://issues.apache.org/jira/browse/SPARK-58529
             Project: Spark
          Issue Type: Improvement
          Components: PySpark
    Affects Versions: 4.3.0
            Reporter: Yicong Huang


worker.py raises RESULT_ROWS_MISMATCH from four places when a UDF returns a row 
count that doesn't match the input. SPARK-58161 hardcoded a message= override 
at each of them carrying a pandas-specific tail: "... Result vector from 
pandas_udf was not the required length: expected N, got M." This tail is 
incorrect on the arrow UDF path: verify_scalar_result is also called for arrow 
UDFs, yet the message says "pandas_udf". This removes all four hardcoded 
message= overrides so the generic RESULT_ROWS_MISMATCH template applies 
uniformly.

The RESULT_ROWS_MISMATCH message changes from "The number of output rows (M) 
must match the number of input rows (N). Result vector from pandas_udf was not 
the required length: expected N, got M." to "The number of output rows (M) must 
match the number of input rows (N)."

While here, consolidate the two row-count helpers -- verify_result_row_count 
(list length) and the iterator-based generator -- into a single judgement 
function that the generator delegates to, and drop the now-redundant 
error_class branch left over from SPARK-58161.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to