This is an automated email from the ASF dual-hosted git repository.

gsaihemanth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new ed1a32cd78b HIVE-28846: Change default value of ifExist in 
dropCatalogRequest to be true (#5713) (Hazel Jiang, Reviewed by Butao Zhang)
ed1a32cd78b is described below

commit ed1a32cd78b8d63616ed45e841f033b3d5fc2adc
Author: Hazel Jiang <[email protected]>
AuthorDate: Thu Mar 27 13:52:41 2025 -0700

    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]>
---
 .../src/gen/thrift/gen-cpp/hive_metastore_types.h             |  4 ++--
 .../apache/hadoop/hive/metastore/api/DropCatalogRequest.java  |  6 ++++--
 .../src/gen/thrift/gen-php/metastore/DropCatalogRequest.php   |  2 +-
 .../src/gen/thrift/gen-py/hive_metastore/ttypes.py            |  4 ++--
 .../src/gen/thrift/gen-rb/hive_metastore_types.rb             |  2 +-
 .../metastore-common/src/main/thrift/hive_metastore.thrift    |  2 +-
 .../org/apache/hadoop/hive/metastore/client/TestCatalogs.java | 11 ++++++-----
 7 files changed, 17 insertions(+), 14 deletions(-)

diff --git 
a/standalone-metastore/metastore-common/src/gen/thrift/gen-cpp/hive_metastore_types.h
 
b/standalone-metastore/metastore-common/src/gen/thrift/gen-cpp/hive_metastore_types.h
index c87daa99f07..da69e33bb45 100644
--- 
a/standalone-metastore/metastore-common/src/gen/thrift/gen-cpp/hive_metastore_types.h
+++ 
b/standalone-metastore/metastore-common/src/gen/thrift/gen-cpp/hive_metastore_types.h
@@ -3478,7 +3478,7 @@ void swap(GetCatalogsResponse &a, GetCatalogsResponse &b);
 std::ostream& operator<<(std::ostream& out, const GetCatalogsResponse& obj);
 
 typedef struct _DropCatalogRequest__isset {
-  _DropCatalogRequest__isset() : name(false), ifExists(false) {}
+  _DropCatalogRequest__isset() : name(false), ifExists(true) {}
   bool name :1;
   bool ifExists :1;
 } _DropCatalogRequest__isset;
@@ -3490,7 +3490,7 @@ class DropCatalogRequest : public virtual 
::apache::thrift::TBase {
   DropCatalogRequest& operator=(const DropCatalogRequest&);
   DropCatalogRequest() noexcept
                      : name(),
-                       ifExists(0) {
+                       ifExists(true) {
   }
 
   virtual ~DropCatalogRequest() noexcept;
diff --git 
a/standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/DropCatalogRequest.java
 
b/standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/DropCatalogRequest.java
index 4b0a8f2026d..83896a66b02 100644
--- 
a/standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/DropCatalogRequest.java
+++ 
b/standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/DropCatalogRequest.java
@@ -99,6 +99,8 @@ public java.lang.String getFieldName() {
   }
 
   public DropCatalogRequest() {
+    this.ifExists = true;
+
   }
 
   public DropCatalogRequest(
@@ -126,8 +128,8 @@ public DropCatalogRequest deepCopy() {
   @Override
   public void clear() {
     this.name = null;
-    setIfExistsIsSet(false);
-    this.ifExists = false;
+    this.ifExists = true;
+
   }
 
   @org.apache.thrift.annotation.Nullable
diff --git 
a/standalone-metastore/metastore-common/src/gen/thrift/gen-php/metastore/DropCatalogRequest.php
 
b/standalone-metastore/metastore-common/src/gen/thrift/gen-php/metastore/DropCatalogRequest.php
index a8098e790bb..aa304ef54d7 100644
--- 
a/standalone-metastore/metastore-common/src/gen/thrift/gen-php/metastore/DropCatalogRequest.php
+++ 
b/standalone-metastore/metastore-common/src/gen/thrift/gen-php/metastore/DropCatalogRequest.php
@@ -40,7 +40,7 @@ class DropCatalogRequest
     /**
      * @var bool
      */
-    public $ifExists = null;
+    public $ifExists = true;
 
     public function __construct($vals = null)
     {
diff --git 
a/standalone-metastore/metastore-common/src/gen/thrift/gen-py/hive_metastore/ttypes.py
 
b/standalone-metastore/metastore-common/src/gen/thrift/gen-py/hive_metastore/ttypes.py
index 9e4cc18513c..939c77561b4 100644
--- 
a/standalone-metastore/metastore-common/src/gen/thrift/gen-py/hive_metastore/ttypes.py
+++ 
b/standalone-metastore/metastore-common/src/gen/thrift/gen-py/hive_metastore/ttypes.py
@@ -4110,7 +4110,7 @@ class DropCatalogRequest(object):
     """
 
 
-    def __init__(self, name=None, ifExists=None,):
+    def __init__(self, name=None, ifExists=True,):
         self.name = name
         self.ifExists = ifExists
 
@@ -32486,7 +32486,7 @@ def __ne__(self, other):
 DropCatalogRequest.thrift_spec = (
     None,  # 0
     (1, TType.STRING, 'name', 'UTF8', None, ),  # 1
-    (2, TType.BOOL, 'ifExists', None, None, ),  # 2
+    (2, TType.BOOL, 'ifExists', None, True, ),  # 2
 )
 all_structs.append(Database)
 Database.thrift_spec = (
diff --git 
a/standalone-metastore/metastore-common/src/gen/thrift/gen-rb/hive_metastore_types.rb
 
b/standalone-metastore/metastore-common/src/gen/thrift/gen-rb/hive_metastore_types.rb
index 5464fe2b6b3..c7407fe73ca 100644
--- 
a/standalone-metastore/metastore-common/src/gen/thrift/gen-rb/hive_metastore_types.rb
+++ 
b/standalone-metastore/metastore-common/src/gen/thrift/gen-rb/hive_metastore_types.rb
@@ -1766,7 +1766,7 @@ class DropCatalogRequest
 
   FIELDS = {
     NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
-    IFEXISTS => {:type => ::Thrift::Types::BOOL, :name => 'ifExists', 
:optional => true}
+    IFEXISTS => {:type => ::Thrift::Types::BOOL, :name => 'ifExists', :default 
=> true, :optional => true}
   }
 
   def struct_fields; FIELDS; end
diff --git 
a/standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift 
b/standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift
index 789942b59dc..09279a550bc 100644
--- 
a/standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift
+++ 
b/standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift
@@ -418,7 +418,7 @@ struct GetCatalogsResponse {
 
 struct DropCatalogRequest {
   1: string name,
-  2: optional bool ifExists
+  2: optional bool ifExists = true
 }
 
 // namespace for tables
diff --git 
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestCatalogs.java
 
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestCatalogs.java
index 89ddede4a26..6854ab9315e 100644
--- 
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestCatalogs.java
+++ 
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestCatalogs.java
@@ -197,16 +197,17 @@ public void createCatalogWithBadLocation() throws 
TException {
 
   @Test(expected = NoSuchObjectException.class)
   public void dropNonExistentCatalog() throws TException {
-    client.dropCatalog("noSuchCatalog");
+    // If explicitly set to false, we expect an exception
+    client.dropCatalog("noSuchCatalog", false);
+    Assert.assertTrue("dropCatalog completed without throwing an exception", 
true);
   }
 
   @Test
-  public void dropNonExistentCatalogIfExists() throws TException {
-    client.dropCatalog("noSuchCatalog", true);
-    Assert.assertTrue("dropCatalog completed without throwing an exception", 
true);
+  public void dropCatalogIfExists() throws TException {
+    // With the default ifExists value of true, no exception should be thrown 
even if the catalog doesn't exist.
+    client.dropCatalog("noSuchCatalog");
   }
 
-
   @Test(expected = MetaException.class)
   public void dropHiveCatalog() throws TException {
     client.dropCatalog(Warehouse.DEFAULT_CATALOG_NAME);

Reply via email to