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-38163][SQL] Preserve the error class of SparkThrowable while constructing of function builder #35467

Closed
wants to merge 2 commits into from

Conversation

MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented Feb 9, 2022

What changes were proposed in this pull request?

In the PR, I propose to propagate SparkThrowable to user space AS IS in constructing of function builder. This allows to preserve the error class, for instance.

Why are the changes needed?

This fixes the issues portrayed by the example below:

scala> try { sql("select format_string('%0$s', 'Hello')") } catch { case e: org.apache.spark.sql.AnalysisException => println(e.getErrorClass) }
null

The expected error should be ILLEGAL_SUBSTRING. It sets at

.

Does this PR introduce any user-facing change?

Yes, the PR changes exceptions that can be handles by users.

After the changes:

scala> try { sql("select format_string('%0$s', 'Hello')") } catch { case e: org.apache.spark.sql.AnalysisException => println(e.getErrorClass) }
ILLEGAL_SUBSTRING

How was this patch tested?

By running new test:

$ build/sbt "test:testOnly *QueryCompilationErrorsSuite"

@HyukjinKwon
Copy link
Member

Merged to master.

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.

3 participants