difin commented on code in PR #5792: URL: https://github.com/apache/hive/pull/5792#discussion_r2097978967
########## 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: `partition` field in `files` metadata table contains partition struct with all partition fields, from all partition specs, so the condition on partition struct should include all fields, for that we need `Partitioning.partitionType(icebergTable)` fields we can get from our spec, because all fields not in the spec need to have null values - done. -- 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