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


##########
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) {

Review Comment:
   Changed the method to return `PartitionSpec`, but it cannot replace 
`Partitioning.partitionType(icebergTable)`. Because the later returns all 
partition fields, from all partition specs, which is needed for us, but 
`getPartitionSpec()` returns only one spec, it doesn't have all the fields.



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