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


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java:
##########
@@ -520,25 +521,27 @@ public static List<String> getPartitionNames(Table table, 
Map<String, String> pa
     }
   }
 
-  public static long getPartitionHash(Table icebergTable, String 
partitionPath) throws IOException {
-    PartitionsTable partitionsTable = (PartitionsTable) MetadataTableUtils
-        .createMetadataTableInstance(icebergTable, 
MetadataTableType.PARTITIONS);
 
-    try (CloseableIterable<FileScanTask> fileScanTasks = 
partitionsTable.newScan().planFiles()) {
-      return FluentIterable.from(fileScanTasks)
-          .transformAndConcat(task -> task.asDataTask().rows())
-          .transform(row -> {
-            StructProjection data = row.get(IcebergTableUtil.PART_IDX, 
StructProjection.class);
-            PartitionSpec spec = 
icebergTable.specs().get(row.get(IcebergTableUtil.SPEC_IDX, Integer.class));
-            PartitionData partitionData = 
IcebergTableUtil.toPartitionData(data,
-                Partitioning.partitionType(icebergTable), 
spec.partitionType());
-            String path = spec.partitionToPath(partitionData);
-            return Maps.immutableEntry(path, data);
-          })
-          .filter(e -> e.getKey().equals(partitionPath))
-          .transform(e -> IcebergAcidUtil.computeHash(e.getValue()))
-          .get(0);
+  public static Integer getPartitionSpecId(Table icebergTable, String 
partitionPath) {
+    if (icebergTable == null || partitionPath == null || 
partitionPath.isEmpty()) {
+      throw new IllegalArgumentException("Table and partitionPath must not be 
null or empty.");
     }
+
+    // Extract field names from the path: "field1=val1/field2=val2" → [field1, 
field2]
+    List<String> fieldNames = Arrays.stream(partitionPath.split("/"))

Review Comment:
   can we use `Warehouse.makeSpecFromName(partitionPath).keySet()` 



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