lasdf1234 commented on code in PR #14462:
URL: https://github.com/apache/gravitino/pull/14462#discussion_r4439703423


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/CatalogWrapperForREST.java:
##########
@@ -719,4 +742,34 @@ private static void replaceDeprecatedProperties(
       properties.put(newProperty, deprecatedValue);
     }
   }
+  /**
+   * Iceberg's plan response serializer refers to delete files by their 
location. Deletion vectors
+   * that share one Puffin file have the same location, so every task would 
refer to whichever of
+   * them was indexed last, and a client would apply the wrong deletion 
vector. Such a plan is
+   * refused rather than answered wrongly.
+   */
+  @VisibleForTesting
+  static void checkDeleteFilesCanBeReferenced(
+      TableIdentifier tableIdentifier, List<FileScanTask> fileScanTasks) {
+    Map<String, DeleteFile> byLocation = new HashMap<>();
+    for (FileScanTask task : fileScanTasks) {
+      for (DeleteFile deleteFile : task.deletes()) {
+        DeleteFile other = byLocation.putIfAbsent(deleteFile.location(), 
deleteFile);
+        if (other != null
+            && !(Objects.equals(other.contentOffset(), 
deleteFile.contentOffset())
+                && Objects.equals(other.referencedDataFile(), 
deleteFile.referencedDataFile()))) {
+          throw new ServiceFailureException(
+              "Server-side scan planning cannot return table %s: several 
deletion vectors are"
+                  + " stored in %s, which the plan response format cannot 
reference separately;"
+                  + " plan the scan on the client",
+              tableIdentifier, deleteFile.location());
+        }
+      }
+    }
+  }
+
+  private static String withoutSchemaStruct(String message) {
+    // Iceberg's binding errors append the whole table struct; it is not 
useful to a client.

Review Comment:
   Could u delete metho 'withoutSchemaStruct'. This method can be implemented 
inline.
   



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

Reply via email to