Skip to content

Commit ed1a32c

Browse files
HIVE-28846: Change default value of ifExist in dropCatalogRequest to be true (#5713) (Hazel Jiang, Reviewed by Butao Zhang)
Co-authored-by: Your Name <[email protected]>
1 parent 541ccaa commit ed1a32c

File tree

7 files changed

+17
-14
lines changed

7 files changed

+17
-14
lines changed

standalone-metastore/metastore-common/src/gen/thrift/gen-cpp/hive_metastore_types.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/DropCatalogRequest.java

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

standalone-metastore/metastore-common/src/gen/thrift/gen-php/metastore/DropCatalogRequest.php

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

standalone-metastore/metastore-common/src/gen/thrift/gen-py/hive_metastore/ttypes.py

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

standalone-metastore/metastore-common/src/gen/thrift/gen-rb/hive_metastore_types.rb

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ struct GetCatalogsResponse {
418418

419419
struct DropCatalogRequest {
420420
1: string name,
421-
2: optional bool ifExists
421+
2: optional bool ifExists = true
422422
}
423423

424424
// namespace for tables

standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestCatalogs.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,17 @@ public void createCatalogWithBadLocation() throws TException {
197197

198198
@Test(expected = NoSuchObjectException.class)
199199
public void dropNonExistentCatalog() throws TException {
200-
client.dropCatalog("noSuchCatalog");
200+
// If explicitly set to false, we expect an exception
201+
client.dropCatalog("noSuchCatalog", false);
202+
Assert.assertTrue("dropCatalog completed without throwing an exception", true);
201203
}
202204

203205
@Test
204-
public void dropNonExistentCatalogIfExists() throws TException {
205-
client.dropCatalog("noSuchCatalog", true);
206-
Assert.assertTrue("dropCatalog completed without throwing an exception", true);
206+
public void dropCatalogIfExists() throws TException {
207+
// With the default ifExists value of true, no exception should be thrown even if the catalog doesn't exist.
208+
client.dropCatalog("noSuchCatalog");
207209
}
208210

209-
210211
@Test(expected = MetaException.class)
211212
public void dropHiveCatalog() throws TException {
212213
client.dropCatalog(Warehouse.DEFAULT_CATALOG_NAME);

0 commit comments

Comments
 (0)