Skip to content

[SPARK-55502][PYTHON] Unify UDF and UDTF Arrow conversion error handling#54398

Open
Yicong-Huang wants to merge 2 commits intoapache:masterfrom
Yicong-Huang:SPARK-55502/refactor/eliminate-is-udtf-flag
Open

[SPARK-55502][PYTHON] Unify UDF and UDTF Arrow conversion error handling#54398
Yicong-Huang wants to merge 2 commits intoapache:masterfrom
Yicong-Huang:SPARK-55502/refactor/eliminate-is-udtf-flag

Conversation

@Yicong-Huang
Copy link
Contributor

@Yicong-Huang Yicong-Huang commented Feb 20, 2026

What changes were proposed in this pull request?

Remove the is_udtf parameter from PandasToArrowConversion.convert() and unify the error handling logic for both UDF and UDTF conversions.

Key changes:

  • Removed is_udtf: bool parameter from conversion methods
  • Unified exception handling: all conversions now use broad ArrowException catching
  • Replaced UDTF-specific UDTF_ARROW_TYPE_CAST_ERROR with generic PySparkTypeError/PySparkValueError

Why are the changes needed?

The is_udtf flag was used to differentiate error handling between UDF and UDTF, but this created unnecessary complexity and inconsistent error messages. Unifying the logic provides:

  • Simpler, more maintainable code
  • Consistent error messages across UDF/UDTF

Does this PR introduce any user-facing change?

Yes, user would see a different error message (error messages change from UDTF-specific to generic), but functionality remains the same.

How was this patch tested?

Existing tests.

Was this patch authored or co-authored using generative AI tooling?

No.

@Yicong-Huang Yicong-Huang force-pushed the SPARK-55502/refactor/eliminate-is-udtf-flag branch from 4b2718e to e250ebf Compare February 20, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments