Skip to content

[SPARK-33515][SQL] Improve exception messages while handling UnresolvedTable #30461

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

Closed
wants to merge 3 commits into from

Conversation

imback82
Copy link
Contributor

What changes were proposed in this pull request?

This PR proposes to improve the exception messages while UnresolvedTable is handled based on this suggestion: #30321 (comment).

Currently, when an identifier is resolved to a view when a table is expected, the following exception message is displayed (e.g., for COMMENT ON TABLE):

v is a temp view not table.

After this PR, the message will be:

v is a temp view. 'COMMENT ON TABLE' expects a table.

Also, if an identifier is not resolved, the following exception message is currently used:

Table not found: t

After this PR, the message will be:

Table not found for 'COMMENT ON TABLE': t 

Why are the changes needed?

To improve the exception message.

Does this PR introduce any user-facing change?

Yes, the exception message will be changed as described above.

How was this patch tested?

Updated existing tests.

@github-actions github-actions bot added the SQL label Nov 23, 2020
@SparkQA
Copy link

SparkQA commented Nov 23, 2020

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/36122/

@SparkQA
Copy link

SparkQA commented Nov 23, 2020

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/36122/

@SparkQA
Copy link

SparkQA commented Nov 23, 2020

Test build #131518 has finished for PR 30461 at commit 7ad0ee2.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 23, 2020

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/36130/

@SparkQA
Copy link

SparkQA commented Nov 23, 2020

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/36130/

@imback82
Copy link
Contributor Author

@cloud-fan Please check if the new exception messages make sense. Thanks!

@SparkQA
Copy link

SparkQA commented Nov 23, 2020

Test build #131528 has finished for PR 30461 at commit 45223a8.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor

GA passed, merging to master, thanks!

@cloud-fan cloud-fan closed this in 60f3a73 Nov 23, 2020
lookupTableOrView(identifier).map {
case v: ResolvedView =>
val viewStr = if (v.isTemp) "temp view" else "view"
u.failAnalysis(s"${v.identifier.quoted} is a $viewStr not table.")
u.failAnalysis(s"${v.identifier.quoted} is a $viewStr. '$cmd' expects a table.'")
Copy link
Member

Choose a reason for hiding this comment

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

' at the end is not needed. I will remove it in this PR: #30398

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @MaxGekk!

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.

4 participants