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


##########
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:
   I think partition limit is also necessary in `get_partitions_by_names` to 
avoid OOM issue, as for whether we need throw exception to client here, I think 
as a provided client it's reasonable to make the code as robust as possible so 
I want such fallback mechanism.
   If you still prefer throw this exception, I will agree and update the code. 
@zhangbutao @deniskuzZ 



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to