wecharyu commented on code in PR #5063:
URL: https://github.com/apache/hive/pull/5063#discussion_r1524161004


##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java:
##########
@@ -3199,19 +3199,24 @@ public Map<Map<String, String>, Partition> 
loadDynamicPartitions(final LoadTable
           
partitionNames.add(Warehouse.makeDynamicPartNameNoTrailingSeperator(details.fullSpec));
         }
       }
-      List<Partition> partitions = Hive.get().getPartitionsByNames(tbl, 
partitionNames);
-      for(Partition partition : partitions) {
-        LOG.debug("HMS partition spec: {}", partition.getSpec());
-        partitionDetailsMap.entrySet().parallelStream()
-            .filter(entry -> 
entry.getValue().fullSpec.equals(partition.getSpec()))
-            .findAny().ifPresent(entry -> {
-          entry.getValue().partition = partition;
-          entry.getValue().hasOldPartition = true;
-        });
-      }
-      // no need to fetch partition again in tasks since we have already 
fetched partitions
-      // info in getPartitionsByNames()
-      fetchPartitionInfo = false;
+      try {
+        List<Partition> partitions = Hive.get().getPartitionsByNames(tbl, 
partitionNames);
+        for(Partition partition : partitions) {
+          LOG.debug("HMS partition spec: {}", partition.getSpec());
+          partitionDetailsMap.entrySet().parallelStream()
+              .filter(entry -> 
entry.getValue().fullSpec.equals(partition.getSpec()))
+              .findAny().ifPresent(entry -> {
+            entry.getValue().partition = partition;
+            entry.getValue().hasOldPartition = true;
+          });
+        }
+        // no need to fetch partition again in tasks since we have already 
fetched partitions
+        // info in getPartitionsByNames()
+        fetchPartitionInfo = false;
+      } catch (HiveException e) {
+        // Failed to fetch partitions in some cases (e.g., partition number 
limit)
+        LOG.warn("Fetching partitions by names failed.", e);

Review Comment:
   There are two ways to fetch partitions from hms in `loadDynamicPartitions()`:
   1. get partitions by names
   2. get partitions one by one
   I think it's reasonable to fallback to the second if the first one failed. 
And we have a warn log to remind client what error happened in 
getPartitionsByNames call.



-- 
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