dengzhhu653 commented on code in PR #3599:
URL: https://github.com/apache/hive/pull/3599#discussion_r1439231267


##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java:
##########
@@ -1100,10 +1100,17 @@ public Partition add_partition(Partition new_part) 
throws TException {
 
   public Partition add_partition(Partition new_part, EnvironmentContext 
envContext)
       throws TException {
-    if (new_part != null && !new_part.isSetCatName()) {
+    if (new_part == null || new_part.getDbName() == null) {
+      throw new MetaException("Partition/DB name cannot be null.");
+    }
+    if (!new_part.isSetCatName()) {
       new_part.setCatName(getDefaultCatalog(conf));
     }
-    Partition p = client.add_partition_with_environment_context(new_part, 
envContext);
+    AddPartitionsRequest addPartitionsReq = new 
AddPartitionsRequest(new_part.getDbName(), new_part.getTableName(),
+            new ArrayList<>(Arrays.asList(new_part)), false);
+    addPartitionsReq.setCatName(new_part.getCatName());
+    addPartitionsReq.setEnvironmentContext(envContext);
+    Partition p = client.add_partition_req(addPartitionsReq);

Review Comment:
   Can we just call `client.add_partitions_req` instead of introducing a new 
similar method?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to