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