xushiyan commented on a change in pull request #5147:
URL: https://github.com/apache/hudi/pull/5147#discussion_r837602689



##########
File path: 
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/util/HivePartitionUtil.java
##########
@@ -48,4 +49,16 @@ public static String getPartitionClauseForDrop(String 
partition, PartitionValueE
     }
     return String.join("/", partBuilder);
   }
+
+  public static Boolean partitionExists(IMetaStoreClient client, String 
tableName, String partitionPath,
+                                        PartitionValueExtractor 
partitionValueExtractor, HiveSyncConfig config) {
+    Partition newPartition;
+    try {
+      List<String> partitionValues = 
partitionValueExtractor.extractPartitionValuesInPath(partitionPath);
+      newPartition = client.getPartition(config.databaseName, tableName, 
partitionValues);
+    } catch (Exception ignored) {
+      newPartition = null;
+    }

Review comment:
       <img width="717" alt="Screen Shot 2022-03-29 at 11 14 27 PM" 
src="https://user-images.githubusercontent.com/2701446/160645043-1e350985-b655-4ecb-8fe9-1fb6f2c8e892.png";>
   
   we shouldn't be catching all exceptions; it could mask other issues. 
Instead, we only catch NoSuchObjectException for partition non-exist case. 
Other exceptions, we should re-throw a hoodie exception containing it.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to