Copilot commented on code in PR #12629:
URL: https://github.com/apache/gluten/pull/12629#discussion_r4466443615


##########
gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergScanTransformer.scala:
##########
@@ -385,6 +417,60 @@ object IcebergScanTransformer {
     GlutenIcebergSourceUtil.isSupportedScan(scan)
   }
 
+  private[execution] def validateDeleteFile(
+      deleteFile: ReadRel.LocalFiles.FileOrFiles.IcebergReadOptions.DeleteFile,
+      supportsEqualityDelete: Boolean,
+      supportsDeletionVector: Boolean,
+      dataFilePath: Option[String] = None): Option[String] = {
+    val content = deleteFile.getFileContent
+    val format = deleteFile.getFileFormatCase
+    if (
+      content ==
+        
ReadRel.LocalFiles.FileOrFiles.IcebergReadOptions.FileContent.EQUALITY_DELETES 
&&
+        !supportsEqualityDelete
+    ) {
+      Some("Contains equality delete files")
+    } else if (
+      format ==
+        
ReadRel.LocalFiles.FileOrFiles.IcebergReadOptions.DeleteFile.FileFormatCase.PUFFIN
+    ) {
+      if (!supportsDeletionVector) {
+        Some("Delete file format puffin is not supported")
+      } else if (
+        content !=
+          
ReadRel.LocalFiles.FileOrFiles.IcebergReadOptions.FileContent.POSITION_DELETES
+      ) {
+        Some("Puffin delete file must contain position deletes")
+      } else if (
+        !deleteFile.hasContentOffset ||
+        deleteFile.getContentOffset < 0 ||
+        !deleteFile.hasContentSizeInBytes ||
+        deleteFile.getContentSizeInBytes <= 0 ||

Review Comment:
   The range checks accept blobs that extend beyond the Puffin file. For 
example, `fileSize = 256`, `contentOffset = 250`, and `contentSizeInBytes = 32` 
passes validation and is forwarded to the native reader even though the 
advertised range cannot be read. Please reject offsets past EOF and lengths 
greater than `fileSize - contentOffset` so malformed ranges trigger fallback; 
subtraction avoids overflow from adding the offset and length.



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

Reply via email to