deniskuzZ commented on code in PR #5123:
URL: https://github.com/apache/hive/pull/5123#discussion_r1525205302


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java:
##########
@@ -2021,4 +2022,34 @@ public List<Partition> 
getPartitionsByExpr(org.apache.hadoop.hive.ql.metadata.Ta
       throw new SemanticException(String.format("Error while fetching the 
partitions due to: %s", e));
     }
   }
+
+  @Override
+  public List<Partition> 
getPartitions(org.apache.hadoop.hive.ql.metadata.Table hmsTable, List<String> 
partSpecs) {
+
+    return partSpecs
+        .stream()
+        .map(spec -> {
+          Map<String, String> partSpecsMap = Arrays.stream(spec.split("/"))
+                  .collect(Collectors.toMap(
+                      x -> x.split("=")[0],
+                      x -> x.split("=")[1]
+                  ));
+          validatePartitionName(hmsTable, partSpecsMap);
+          return spec;
+        })
+        .map(partName -> new DummyPartition(hmsTable, partName))
+        .collect(Collectors.toList());
+  }
+
+  private void validatePartitionName(org.apache.hadoop.hive.ql.metadata.Table 
hmsTable, Map<String, String> partSpec) {
+    try {
+      List<String> partNames = getPartitionNames(hmsTable, partSpec);
+
+      if (partNames.isEmpty()) {
+        throw new RuntimeException("Failed getting partitions from partition 
spec");

Review Comment:
   do we have some more specific exceptions in Hive?



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