difin commented on code in PR #6690:
URL: https://github.com/apache/hive/pull/6690#discussion_r3784428516


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java:
##########
@@ -775,15 +775,25 @@ public static PartitionSpec getPartitionSpec(Table 
icebergTable, String partitio
     // Extract field names from the path: "field1=val1/field2=val2" → [field1, 
field2]
     List<String> fieldNames = 
Lists.newArrayList(Warehouse.makeSpecFromName(partitionPath).keySet());
 
-    return icebergTable.specs().values().stream()
+    List<PartitionSpec> matches = icebergTable.specs().values().stream()
         .filter(spec -> {
           List<String> specFieldNames = spec.fields().stream()
               .map(PartitionField::name)
               .toList();
           return specFieldNames.equals(fieldNames);
         })
-        .findFirst() // Supposed to be only one matching spec
-        .orElseThrow(() -> new HiveException("No matching partition spec found 
for partition path: " + partitionPath));
+        .toList();
+
+    if (matches.size() > 1) {
+      throw new HiveException(String.format(
+          "Ambiguous partition spec for partition path %s: matched spec ids 
%s",
+          partitionPath,
+          
matches.stream().map(PartitionSpec::specId).map(String::valueOf).collect(Collectors.joining(",
 "))));
+    }

Review Comment:
   This is only an error message, no code depends on 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]


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

Reply via email to