You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/01/17 20:46:24 UTC

[GitHub] [iceberg] rdblue commented on a change in pull request #3763: Spark: Implement merge-on-read DELETE

rdblue commented on a change in pull request #3763:
URL: https://github.com/apache/iceberg/pull/3763#discussion_r786281811



##########
File path: api/src/main/java/org/apache/iceberg/types/TypeUtil.java
##########
@@ -319,20 +319,45 @@ public static boolean isPromotionAllowed(Type from, Type.PrimitiveType to) {
    */
   public static void validateWriteSchema(Schema tableSchema, Schema writeSchema,
                                          Boolean checkNullability, Boolean checkOrdering) {
+    String errMsg = "Cannot write incompatible dataset to table with schema:";
+    checkSchemaCompatibility(errMsg, tableSchema, writeSchema, checkNullability, checkOrdering);
+  }
+
+  /**
+   * Validates whether the provided schema is compatible with the expected schema.
+   *
+   * @param context the schema context (e.g. row ID)
+   * @param expectedSchema the expected schema
+   * @param providedSchema the provided schema
+   * @param checkNullability whether to check field nullability
+   * @param checkOrdering whether to check field ordering
+   */
+  public static void validateSchema(String context, Schema expectedSchema, Schema providedSchema,
+                                    boolean checkNullability, boolean checkOrdering) {
+    String errMsg = String.format("Provided %s schema is incompatible with expected %s schema:", context, context);

Review comment:
       Do we need context twice? I think that "expected schema" is nearly equivalent to "expected row ID schema" if "row ID" was used the first time, "Provided row ID schema ...".




-- 
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-unsubscribe@iceberg.apache.org

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



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