nastra commented on code in PR #11302:
URL: https://github.com/apache/iceberg/pull/11302#discussion_r1824259461


##########
data/src/main/java/org/apache/iceberg/data/BaseDeleteLoader.java:
##########
@@ -259,4 +294,40 @@ private long estimateEqDeletesSize(DeleteFile deleteFile, 
Schema projection) {
   private int estimateRecordSize(Schema schema) {
     return schema.columns().stream().mapToInt(TypeUtil::estimateSize).sum();
   }
+
+  private boolean containsDVs(Iterable<DeleteFile> deleteFiles) {
+    return Iterables.any(deleteFiles, ContentFileUtil::isDV);
+  }
+
+  private void validateDV(DeleteFile deleteFile, CharSequence filePath) {
+    Preconditions.checkArgument(deleteFile.contentOffset() != null, "DV offset 
is missing");
+    Preconditions.checkArgument(deleteFile.contentSizeInBytes() != null, "DV 
length is missing");
+    Preconditions.checkArgument(
+        deleteFile.contentSizeInBytes() <= Integer.MAX_VALUE,
+        "Can't read DV larger than 2GB: %s",
+        deleteFile.contentSizeInBytes());
+    Preconditions.checkArgument(
+        filePath.toString().equals(deleteFile.referencedDataFile()),
+        "DV must reference %s, not %s",
+        filePath,
+        deleteFile.referencedDataFile());
+  }
+
+  private byte[] readBytes(InputFile inputFile, long offset, int length) {
+    try (SeekableInputStream stream = inputFile.newStream()) {
+      byte[] bytes = new byte[length];
+
+      if (stream instanceof RangeReadable) {

Review Comment:
   looks like this is re-using the same functionality that `PuffinReader` has 
internally, so not sure if it's worth extracting that into a common method



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to