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-36303][SQL] Refactor fourthteenth set of 20 query execution errors to use error classes #33878

Closed
wants to merge 12 commits into from

Conversation

dgd-contributor
Copy link

What changes were proposed in this pull request?

Why are the changes needed?

Adds error classes to some of the exceptions in QueryExecutionErrors.

Does this PR introduce any user-facing change?

Improves auditing for developers and adds useful fields for users (error class and SQLSTATE).

How was this patch tested?

Existing tests

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@HyukjinKwon
Copy link
Member

cc @karenfeng FYI

Copy link
Contributor

@karenfeng karenfeng left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @dgd-contributor! I left some comments.

@dgd-contributor
Copy link
Author

Thanks for your comments @karenfeng , can you review it again?

Copy link
Contributor

@karenfeng karenfeng left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @dgd-contributor! I left some comments; please tag me once you get a chance to address them.

new SparkNoSuchElementException(
errorClass = "NO_SUCH_ELEMENT_EXCEPTION",
messageParameters = Array.empty
)
}

def noSuchElementExceptionError(key: String): Throwable = {
new NoSuchElementException(key)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should share an error class with the exception above.

@@ -77,6 +144,9 @@
"message" : [ "PARTITION clause cannot contain a non-partition column name: %s" ],
"sqlState" : "42000"
},
"NO_SUCH_ELEMENT_EXCEPTION" : {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should:

  • Remove the word EXCEPTION from the error class.
  • Update the error message to better reflect what type of error this is, maybe with No such element %s?

@@ -21,6 +67,15 @@
"FAILED_SET_ORIGINAL_PERMISSION_BACK" : {
"message" : [ "Failed to set original permission %s back to the created path: %s. Exception: %s" ]
},
"FAILED_TO_CALL_PUBLIC_NO_ARG_CONSTRUCTOR_FOR_CONSTRUCTOR" : {
Copy link
Contributor

Choose a reason for hiding this comment

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

FAILED_TO_CALL_PUBLIC_NO_ARG_CONSTRUCTOR_FOR_CONSTRUCTOR -> FAILED_TO_CALL_PUBLIC_NO_ARG_CONSTRUCTOR_FOR_CATALOG

"FAILED_TO_CALL_PUBLIC_NO_ARG_CONSTRUCTOR_FOR_CONSTRUCTOR" : {
"message" : [ "Failed to call public no-arg constructor for catalog '%s': %s" ]
},
"FAILED_TO_FIND_PUBLIC_NO_ARG_CONSTRUCTOR_FOR_CONSTRUCTOR" : {
Copy link
Contributor

Choose a reason for hiding this comment

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

FAILED_TO_FIND_PUBLIC_NO_ARG_CONSTRUCTOR_FOR_CONSTRUCTOR -> FAILED_TO_FIND_PUBLIC_NO_ARG_CONSTRUCTOR_FOR_CATALOG

"Cannot set timeout timestamp without enabling event time timeout in " +
"[map|flatMapGroupsWithState")
new SparkUnsupportedOperationException(
errorClass = "CANNOT_GET_EVENT_TIME_WATERMARK",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the right error class?

"sqlState" : "42000"
},
"CANNOT_SET_TIMEOUT_TIMESTAMP" : {
"message" : [ "Cannot set timeout timestamp without enabling event time timeout in [map|flatMapGroupsWithState" ],
Copy link
Contributor

Choose a reason for hiding this comment

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

[map|flatMap -> [map|flatMap]

},
"CANNOT_CLONE_OR_COPY_READ_ONLY_SQL_CONF" : {
"message" : [ "Cannot clone/copy ReadOnlySQLConf." ],
"sqlState" : "42000"
Copy link
Contributor

Choose a reason for hiding this comment

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

0A000 may be a better fit here

},
"CANNOT_EXECUTE_STREAMING_RELATION_EXEC" : {
"message" : [ "StreamingRelationExec cannot be executed" ],
"sqlState" : "42000"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an internal error; we should remove the SQLSTATE.

},
"CANNOT_MUTATE_READ_ONLY_SQL_CONF" : {
"message" : [ "Cannot mutate ReadOnlySQLConf." ],
"sqlState" : "42000"
Copy link
Contributor

Choose a reason for hiding this comment

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

0A000 feels like a better fit for this

},
"CATALOG_PLUGIN_CLASS_NOT_FOUND" : {
"message" : [ "Catalog '%s' plugin class not found: spark.sql.catalog.%s is not defined" ],
"sqlState" : "42000"
Copy link
Contributor

Choose a reason for hiding this comment

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

42000 doesn't seem like the right SQLSTATE here. Maybe 3D000?

@github-actions
Copy link

github-actions bot commented Jan 7, 2022

We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!

@github-actions github-actions bot added the Stale label Jan 7, 2022
@github-actions github-actions bot closed this Jan 8, 2022
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.

5 participants