-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-34317][SQL] Introduce relationTypeMismatchHint to UnresolvedTable for a better error message #31424
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
Conversation
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #134745 has finished for PR 31424 at commit
|
|
thanks, merging to master! |
| case u @ UnresolvedTable(identifier, cmd, relationTypeMismatchHint) => | ||
| lookupTableOrView(identifier).map { | ||
| case v: ResolvedView => throw QueryCompilationErrors.expectTableNotViewError(v, cmd, u) | ||
| case v: ResolvedView => |
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.
@cloud-fan looks like I missed handling this in ResolveTempViews. I will create a follow up PR. Sorry about that.
…olvedTable is resolved to a temp view ### What changes were proposed in this pull request? This is a follow up to #31424, and proposes to use `UnresolvedTable.relationTypeMismatchHint` when `UnresolvedTable` is resolved to a temp view. ### Why are the changes needed? This change utilizes the type mismatch hint when a relation is resolved to a temp view when a table is expected. For example, `ALTER TABLE tmpView SET TBLPROPERTIES ('p' = 'an')` will now include `Please use ALTER VIEW instead.` in the exception message: `tmpView is a temp view. 'ALTER TABLE ... SET TBLPROPERTIES' expects a table. Please use ALTER VIEW instead.` ### Does this PR introduce _any_ user-facing change? Yes, adds the hint in the exception message. ### How was this patch tested? Update existing tests to include the hint. Closes #31452 from imback82/followup_SPARK-34317. Authored-by: Terry Kim <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
…ble for a better error message ### What changes were proposed in this pull request? This PR proposes to add `relationTypeMismatchHint` to `UnresolvedTable` so that if a relation is resolved to a view when a table is expected, a hint message can be included as a part of the analysis exception message. Note that the same feature is already introduced to `UnresolvedView` in apache#30636. This mostly affects `ALTER TABLE` commands where the analysis exception message will now contain `Please use ALTER VIEW as instead`. ### Why are the changes needed? To give a better error message. (The hint used to exist but got removed for commands that migrated to the new resolution framework) ### Does this PR introduce _any_ user-facing change? Yes, now `ALTER TABLE` commands include a hint to use `ALTER VIEW` instead. ``` sql("ALTER TABLE v SET SERDE 'whatever'") ``` Before: ``` "v is a view. 'ALTER TABLE ... SET [SERDE|SERDEPROPERTIES]' expects a table. ``` After this PR: ``` "v is a view. 'ALTER TABLE ... SET [SERDE|SERDEPROPERTIES]' expects a table. Please use ALTER VIEW instead. ``` ### How was this patch tested? Updated existing test cases to include the hint. Closes apache#31424 from imback82/better_error. Authored-by: Terry Kim <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
…olvedTable is resolved to a temp view ### What changes were proposed in this pull request? This is a follow up to apache#31424, and proposes to use `UnresolvedTable.relationTypeMismatchHint` when `UnresolvedTable` is resolved to a temp view. ### Why are the changes needed? This change utilizes the type mismatch hint when a relation is resolved to a temp view when a table is expected. For example, `ALTER TABLE tmpView SET TBLPROPERTIES ('p' = 'an')` will now include `Please use ALTER VIEW instead.` in the exception message: `tmpView is a temp view. 'ALTER TABLE ... SET TBLPROPERTIES' expects a table. Please use ALTER VIEW instead.` ### Does this PR introduce _any_ user-facing change? Yes, adds the hint in the exception message. ### How was this patch tested? Update existing tests to include the hint. Closes apache#31452 from imback82/followup_SPARK-34317. Authored-by: Terry Kim <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
What changes were proposed in this pull request?
This PR proposes to add
relationTypeMismatchHinttoUnresolvedTableso that if a relation is resolved to a view when a table is expected, a hint message can be included as a part of the analysis exception message. Note that the same feature is already introduced toUnresolvedViewin #30636.This mostly affects
ALTER TABLEcommands where the analysis exception message will now containPlease use ALTER VIEW as instead.Why are the changes needed?
To give a better error message. (The hint used to exist but got removed for commands that migrated to the new resolution framework)
Does this PR introduce any user-facing change?
Yes, now
ALTER TABLEcommands include a hint to useALTER VIEWinstead.Before:
After this PR:
How was this patch tested?
Updated existing test cases to include the hint.