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-49951][SQL] Assign proper error condition for _LEGACY_ERROR_TEMP_(1099|3085) #48449

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

Conversation

itholic
Copy link
Contributor

@itholic itholic commented Oct 14, 2024

What changes were proposed in this pull request?

This PR proposes to assign proper error condition & sqlstate for LEGACY_ERROR_TEMP(1099|3085)

Why are the changes needed?

To improve the error message by assigning proper error condition and SQLSTATE

Does this PR introduce any user-facing change?

No, only user-facing error message improved

How was this patch tested?

Updated the existing tests

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

No

Comment on lines 110 to 121
checkError(
exception = intercept[AnalysisException] {
avroStructDF.select(
functions.from_avro(
$"avro", avroTypeStruct, Map("mode" -> "DROPMALFORMED").asJava)).collect()
},
condition = "PARSE_MODE_UNSUPPORTED",
parameters = Map(
"funcName" -> "from_avro",
"mode" -> "DROPMALFORMED",
"permissiveMode" -> "PERMISSIVE",
"failFastMode" -> "FAILFAST"))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added new test for _LEGACY_ERROR_TEMP_3085
cc @MaxGekk fyi

@@ -1341,12 +1341,10 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase with Compilat

def parseModeUnsupportedError(funcName: String, mode: ParseMode): Throwable = {
new AnalysisException(
errorClass = "_LEGACY_ERROR_TEMP_1099",
errorClass = "PARSE_MODE_UNSUPPORTED",
messageParameters = Map(
"funcName" -> funcName,
Copy link
Member

Choose a reason for hiding this comment

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

Since it is an id, please, quote it:

Suggested change
"funcName" -> funcName,
"funcName" -> toSQLId(funcName),

"permissiveMode" -> PermissiveMode.name,
"failFastMode" -> FailFastMode.name))
throw QueryCompilationErrors.parseModeUnsupportedError(
"from_avro", parseMode
Copy link
Member

Choose a reason for hiding this comment

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

Please, use prettyName

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants