szehon-ho commented on code in PR #4812:
URL: https://github.com/apache/iceberg/pull/4812#discussion_r919443384
##########
core/src/main/java/org/apache/iceberg/DataFiles.java:
##########
@@ -108,6 +108,31 @@ public static DataFile fromManifest(ManifestFile manifest)
{
.build();
}
+ public static DataFile fromPositionDelete(DeleteFile deleteFile,
PartitionSpec spec) {
+
Preconditions.checkArgument(deleteFile.content().equals(FileContent.POSITION_DELETES),
+ "Expected positional delete file, found %s", deleteFile.content());
+ Metrics metrics = new Metrics(
+ deleteFile.recordCount(),
+ deleteFile.columnSizes(),
+ deleteFile.valueCounts(),
+ deleteFile.nullValueCounts(),
+ deleteFile.nanValueCounts(),
+ deleteFile.lowerBounds(),
+ deleteFile.upperBounds()
+ );
+
+ return DataFiles.builder(spec)
+ .withEncryptionKeyMetadata(deleteFile.keyMetadata())
+ .withFormat(deleteFile.format())
+ .withFileSizeInBytes(deleteFile.fileSizeInBytes())
+ .withPath(deleteFile.path().toString())
+ .withPartition(deleteFile.partition())
+ .withRecordCount(deleteFile.recordCount())
+ .withSortOrder(SortOrder.unsorted())
Review Comment:
In my test, sort order id doesnt seem to be populated on delete files
(returns null), but added a conditional set in case it is populated.
--
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]