Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-49916][SQL] Throw appropriate Exception for type mismatch between ColumnType and data type in some rows #48397

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

RaleSapic
Copy link

What changes were proposed in this pull request?

In this PR, I introduced new exception to be thrown when there is a mismatch between type of the elements in the array column type, and the actual values of that column. Currently, this can happen in Postgres SQL when type of a column is
real[] (array of floats), and insert command provides real[][] (array of arrays of floats).

In our case, we are letting this to be converted to Spark SQL Types, and fail when trying to read it later. This PR is catching currently thrown internal exception (java.lang.ClassCastException) and re-throw a newly-introduced exception for this problem.

Why are the changes needed?

Throwing better exception that will help Spark user to better understand why the query failed.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Existing, and newly-added unit tests for Postgres.

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

No

@github-actions github-actions bot added the SQL label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants