-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-17502] [17609] [SQL] [Backport] [2.0] Fix Multiple Bugs in DDL Statements on Temporary Views #15174
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
|
Test build #65702 has finished for PR 15174 at commit
|
|
cc @cloud-fan |
|
LGTM, if you have time, can you also include #15160? they are kind of related. thanks! |
|
Sure, will do it. |
|
FYI, most code changes of #15160 in |
| sessionState.catalog.lookupRelation(tableIdentWithDB)) match { | ||
| // Pass a table identifier with database part, so that `tableExists` won't check temp | ||
| // views unexpectedly. | ||
| EliminateSubqueryAliases(sessionState.catalog.lookupRelation(tableIdentWithDB)) match { |
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.
we don't need tableIdentWithDB in CreateDataSourceTableCommand right?
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.
Done. : )
| """.stripMargin) | ||
|
|
||
| case InsertIntoTable(t, _, _, _, _) | ||
| if !t.isInstanceOf[LeafNode] || |
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.
I was wondering why not replacing these one-letter values with something more explicit (like table in the following case) ? I understand that this is not the purpose of the PR, but just interested if it is normal to highlight those "style" things in PR discussion or not.
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.
This PR is to backport the fix from the master branch to Spark 2.0 branch. I think your comment is valid. You can submit a PR for improving the code style. Thanks!
|
Test build #65763 has finished for PR 15174 at commit
|
|
Test build #65777 has finished for PR 15174 at commit
|
|
thanks, merging to 2.0! |
…tements on Temporary Views ### What changes were proposed in this pull request? This PR is to backport #15054 and #15160 to Spark 2.0. - When the permanent tables/views do not exist but the temporary view exists, the expected error should be `NoSuchTableException` for partition-related ALTER TABLE commands. However, it always reports a confusing error message. For example, ``` Partition spec is invalid. The spec (a, b) must match the partition spec () defined in table '`testview`'; ``` - When the permanent tables/views do not exist but the temporary view exists, the expected error should be `NoSuchTableException` for `ALTER TABLE ... UNSET TBLPROPERTIES`. However, it reports a missing table property. For example, ``` Attempted to unset non-existent property 'p' in table '`testView`'; ``` - When `ANALYZE TABLE` is called on a view or a temporary view, we should issue an error message. However, it reports a strange error: ``` ANALYZE TABLE is not supported for Project ``` - When inserting into a temporary view that is generated from `Range`, we will get the following error message: ``` assertion failed: No plan for 'InsertIntoTable Range (0, 10, step=1, splits=Some(1)), false, false +- Project [1 AS 1#20] +- OneRowRelation$ ``` This PR is to fix the above four issues. There is no place in Spark SQL that need `SessionCatalog.tableExists` to check temp views, so this PR makes `SessionCatalog.tableExists` only check permanent table/view and removes some hacks. ### How was this patch tested? Added multiple test cases Author: gatorsmile <[email protected]> Closes #15174 from gatorsmile/PR15054Backport.
|
Let me close it. Thanks! |
What changes were proposed in this pull request?
This PR is to backport #15054 and #15160 to Spark 2.0.
NoSuchTableExceptionfor partition-related ALTER TABLE commands. However, it always reports a confusing error message. For example,NoSuchTableExceptionforALTER TABLE ... UNSET TBLPROPERTIES. However, it reports a missing table property. For example,ANALYZE TABLEis called on a view or a temporary view, we should issue an error message. However, it reports a strange error:Range, we will get the following error message:This PR is to fix the above four issues.
There is no place in Spark SQL that need
SessionCatalog.tableExiststo check temp views, so this PR makesSessionCatalog.tableExistsonly check permanent table/view and removes some hacks.How was this patch tested?
Added multiple test cases