-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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-19952][SQL] Remove various analysis exceptions #17716
Conversation
case _: NoSuchTableException => | ||
u.failAnalysis(s"Table or view not found: ${tableIdentWithDb.unquotedString}") | ||
// If the database is defined and that database is not found, throw an AnalysisException. | ||
if (!tableIdentWithDb.database.exists(catalog.databaseExists)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should move this into catalog.lookupRelation
and attach the location here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about
try {
catalog.lookupRelation(tableIdentWithDb)
} catch {
case a: AnalysisException => u.failAnalysis(a.message)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, could work. This change is also causing the tests to fail, so I am revisiting it.
Test build #76031 has finished for PR 17716 at commit
|
Test build #76039 has finished for PR 17716 at commit
|
@@ -160,7 +159,7 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils { | |||
} | |||
|
|||
private def assertNoSuchTable(query: String): Unit = { | |||
intercept[NoSuchTableException] { | |||
intercept[AnalysisException] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AnalysisException
is a pretty general Exception in Spark SQL. The future refactoring might introduce bugs without trigger any test case failure.
Could we check the error messages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
@hvanhovell, how is it going? |
ping @hvanhovell Are you still working on this? |
What changes were proposed in this pull request?
We currently have quite a few analysis exception subclasses, the problem with these is that they are not well supported throughout Spark (in pySpark for example) and that the added value is limited. This PR removes the
no such object
and thealready exists
exceptions, and replaces them by a factory methods that create analysis exceptions with the required error messages.How was this patch tested?
Modified existing tests.