Skip to content

[SPARK-58585][SQL] Extract a helper for INVALID_EXTERNAL_VALUE errors in CatalystTypeConverters - #57786

Open
uros-b wants to merge 1 commit into
apache:masterfrom
uros-b:helper-invalid-external-value
Open

[SPARK-58585][SQL] Extract a helper for INVALID_EXTERNAL_VALUE errors in CatalystTypeConverters#57786
uros-b wants to merge 1 commit into
apache:masterfrom
uros-b:helper-invalid-external-value

Conversation

@uros-b

@uros-b uros-b commented Aug 5, 2026

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

Extracts a private helper throwInvalidExternalValue(value, dataType): Nothing in CatalystTypeConverters and routes the eight byte-identical INVALID_EXTERNAL_VALUE throw sites through it.

Why are the changes needed?

The eight throw blocks were identical apart from the trailing dataType argument, so the same six lines were repeated eight times. Factoring them into one helper removes about 31 lines of duplication with no behavior change: the same error class and the same three message parameters (other, otherClass, dataType) are produced, and the Nothing return type keeps every match arm's result type unchanged.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Behavior-preserving refactor. Existing conversion tests, which assert the error condition and its parameters via checkError, cover these paths. No new tests needed.

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

Generated-by: Claude Code (Opus 4.8)

@uros-b
uros-b requested a review from MaxGekk August 5, 2026 08:40

@uros-b uros-b left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting for CI; cc @MaxGekk for review

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