difin commented on code in PR #5529:
URL: https://github.com/apache/hive/pull/5529#discussion_r1843008560
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java:
##########
@@ -458,6 +458,52 @@ public static List<DeleteFile> getDeleteFiles(Table table,
String partitionPath)
t -> ((PositionDeletesScanTask) t).file()));
}
+ public static float getFileSizeRatio(Table table, String partitionPath, long
fileSizeInBytesThreshold) {
+ long uncompactedFilesCount = getDataFileCount(table, partitionPath,
fileSizeInBytesThreshold, true);
+ long compactedFilesCount = getDataFileCount(table, partitionPath,
fileSizeInBytesThreshold, false);
Review Comment:
A file is decided to be compacted or uncompacted based on comparing its
actual size with the threshold defined in Conf depending on compaction type:
```
HIVE_ICEBERG_MAJOR_COMPACTION_FILE_SIZE_THRESHOLD("hive.iceberg.major.compaction.file.size.threshold",
"96mb",
new SizeValidator(), "Iceberg data file size in megabytes below
which a file needs to be compacted."),
HIVE_ICEBERG_MINOR_COMPACTION_FILE_SIZE_THRESHOLD("hive.iceberg.minor.compaction.file.size.threshold",
"16mb",
new SizeValidator(), "Iceberg data file size in megabytes below
which a file needs to be compacted."),
```
fileSizeInBytesThreshold gets the value from these configs depending on
compaction type.
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java:
##########
@@ -458,6 +458,52 @@ public static List<DeleteFile> getDeleteFiles(Table table,
String partitionPath)
t -> ((PositionDeletesScanTask) t).file()));
}
+ public static float getFileSizeRatio(Table table, String partitionPath, long
fileSizeInBytesThreshold) {
+ long uncompactedFilesCount = getDataFileCount(table, partitionPath,
fileSizeInBytesThreshold, true);
+ long compactedFilesCount = getDataFileCount(table, partitionPath,
fileSizeInBytesThreshold, false);
Review Comment:
A file is decided to be compacted or uncompacted based on comparing its
actual size with the threshold defined in Conf depending on compaction type:
```
HIVE_ICEBERG_MAJOR_COMPACTION_FILE_SIZE_THRESHOLD("hive.iceberg.major.compaction.file.size.threshold",
"96mb",
new SizeValidator(), "Iceberg data file size in megabytes below
which a file needs to be compacted."),
HIVE_ICEBERG_MINOR_COMPACTION_FILE_SIZE_THRESHOLD("hive.iceberg.minor.compaction.file.size.threshold",
"16mb",
new SizeValidator(), "Iceberg data file size in megabytes below
which a file needs to be compacted."),
```
fileSizeInBytesThreshold gets the value from these configs depending on
compaction type.
--
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]