Uh oh!
There was an error while loading. Please reload this page.
[SPARK-24669][SQL] Invalidate tables in case of DROP DATABASE CASCADE - #23905
[SPARK-24669][SQL] Invalidate tables in case of DROP DATABASE CASCADE#23905Udbhav30 wants to merge 1 commit into
Conversation
Uh oh!
There was an error while loading. Please reload this page.
dilipbiswal
left a comment
There was a problem hiding this comment.
On the call to drop the database, we can get an error. For example, its not allowed to drop the default database. In that case, even though we are not going to go ahead with the drop database action, we will end up refreshing all the tables inside it ? Is that expected ?
Udbhav30
commented
Feb 27, 2019
modified |
Udbhav30
commented
Feb 28, 2019
CC @HyukjinKwon |
There was a problem hiding this comment.
Can this logic move under catalog.dropDatabase function ? The reason is, we have the following code in dropDatabase.
val dbName = formatDatabaseName(db)
if (dbName == DEFAULT_DATABASE) {
throw new AnalysisException(s"Can not drop default database")
}
If we keep it here, then we should have identical check. In this case formatDatabase().. handles case sensitivity in the database name. Also we should use DEFAULT_DATABASE as opposed to hard coding it here.
2ndly, can any of the calls 1) listTables 2)refreshTable throw exception ? In this case, do we want to fail the drop operation or allow the drop with a warning ? I don't know the answer. Just list the questions here so others can help answer.
cc @cloud-fan@gatorsmile for their input.
There was a problem hiding this comment.
yes i have moved that code to catalog.dropDatabase functions, i also think that make more sense
felixcheung
left a comment
There was a problem hiding this comment.
I'd a bit worry about this approach. shouldn't this be done up to the user and not automatically?
Udbhav30
commented
Feb 28, 2019
Can we do it on the behalf of user as we are following this approach while using dropTable and refresh the table so these changes will also make it inline with dropTable behaviour. |
Udbhav30
commented
Mar 1, 2019
cc @gatorsmile@dongjoon-hyun can you please review this. |
dongjoon-hyun
left a comment
There was a problem hiding this comment.
Thank you for your first contribution, @Udbhav30 .
I left a few comment. Also, could you move this test case to DDLSuite.scala? If you put it there, InMemoryCatalogedDDLSuite and HiveCatalogedDDLSuite will test it.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
6accf35 to
188ae92CompareUdbhav30
commented
Mar 1, 2019
@dongjoon-hyun I have done the suggested changes |
dongjoon-hyun
commented
Mar 1, 2019
ok to test |
SparkQA
commented
Mar 1, 2019
Test build #102917 has finished for PR 23905 at commit
|
@Udbhav30 . Two test case failures look relevant to this PR. Could you check them by running locally? Please update this PR after you pass them locally. Thanks. |
Udbhav30
commented
Mar 4, 2019
yes i will check and update |
SparkQA
commented
Mar 4, 2019
Test build #102995 has finished for PR 23905 at commit
|
SparkQA
commented
Mar 4, 2019
Test build #103001 has finished for PR 23905 at commit
|
Udbhav30
commented
Mar 5, 2019
@dongjoon-hyun i have handled all suggestions please let me know if anymore suggestions are there |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The goal of this PR is invalidating the tables. So, let's use more narrow API here instead of refreshTable.
- refreshTable(t)
+ invalidateCachedTable(QualifiedTableName(dbName, t.table))Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
@dongjoon-hyun Do we need to worry about any recurring exceptions from this call like following ?
http://discuss.itversity.com/t/unable-to-perform-listtables-on-spark-catalog-class/15888
Should we fail the drop database or warn and proceed ?
There was a problem hiding this comment.
The best behavior is compatible with the old Spark behavior. So, that will be warn and proceed.
c4e3214 to
eab40d6CompareSparkQA
commented
Mar 6, 2019
Test build #103082 has finished for PR 23905 at commit
|
SparkQA
commented
Mar 6, 2019
Test build #103083 has finished for PR 23905 at commit
|
SparkQA
commented
Mar 6, 2019
Test build #103081 has finished for PR 23905 at commit
|
cloud-fan
commented
Mar 6, 2019
retest this please |
SparkQA
commented
Mar 6, 2019
Test build #103093 has finished for PR 23905 at commit
|
There was a problem hiding this comment.
Thank you for your first contribution, @Udbhav30 . And thank you, @SongYadong , @dilipbiswal , @felixcheung , @cloud-fan .
+1, LGTM, too. Merged to master/2.4/2.3.
For the MetaException, we can ignore for now since it seems that Spark don't handle that except partitioning handling cases. We can revisit that if needed later.
## What changes were proposed in this pull request? Before dropping database refresh the tables of that database, so as to refresh all cached entries associated with those tables. We follow the same when dropping a table. UT is added Closes#23905 from Udbhav30/SPARK-24669. Authored-by: Udbhav30 <u.agrawal30@gmail.com> Signed-off-by: Dongjoon Hyun <dhyun@apple.com> (cherry picked from commit 9bddf71) Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
## What changes were proposed in this pull request? Before dropping database refresh the tables of that database, so as to refresh all cached entries associated with those tables. We follow the same when dropping a table. UT is added Closes#23905 from Udbhav30/SPARK-24669. Authored-by: Udbhav30 <u.agrawal30@gmail.com> Signed-off-by: Dongjoon Hyun <dhyun@apple.com> (cherry picked from commit 9bddf71) Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
## What changes were proposed in this pull request? Before dropping database refresh the tables of that database, so as to refresh all cached entries associated with those tables. We follow the same when dropping a table. UT is added Closesapache#23905 from Udbhav30/SPARK-24669. Authored-by: Udbhav30 <u.agrawal30@gmail.com> Signed-off-by: Dongjoon Hyun <dhyun@apple.com> (cherry picked from commit 9bddf71) Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
## What changes were proposed in this pull request? Before dropping database refresh the tables of that database, so as to refresh all cached entries associated with those tables. We follow the same when dropping a table. UT is added Closesapache#23905 from Udbhav30/SPARK-24669. Authored-by: Udbhav30 <u.agrawal30@gmail.com> Signed-off-by: Dongjoon Hyun <dhyun@apple.com> (cherry picked from commit 9bddf71) Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
## What changes were proposed in this pull request? Before dropping database refresh the tables of that database, so as to refresh all cached entries associated with those tables. We follow the same when dropping a table. UT is added Closesapache#23905 from Udbhav30/SPARK-24669. Authored-by: Udbhav30 <u.agrawal30@gmail.com> Signed-off-by: Dongjoon Hyun <dhyun@apple.com> (cherry picked from commit 9bddf71) Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
What changes were proposed in this pull request?
Before dropping database refresh the tables of that database, so as to refresh all cached entries associated with those tables.
We follow the same when dropping a table.
How was this patch tested?
UT is added