rahil-c commented on code in PR #17573:
URL: https://github.com/apache/hudi/pull/17573#discussion_r2631362482
##########
hudi-common/src/main/java/org/apache/hudi/common/schema/HoodieSchemaUtils.java:
##########
@@ -79,6 +79,24 @@ public static HoodieSchema createHoodieWriteSchema(String
schema, boolean withOp
return HoodieSchema.fromAvroSchema(avroSchema);
}
+ /**
+ * Creates a write schema for Hudi operations, adding necessary metadata
fields.
+ * This is equivalent to HoodieAvroUtils.createHoodieWriteSchema() but
operates on HoodieSchema.
+ *
+ * @param schema the base HoodieSchema
+ * @param withOperationField whether to include operation metadata field
+ * @return HoodieSchema configured for write operations with metadata fields
added
+ * @throws IllegalArgumentException if schema is null
+ * @since 1.2.0
+ */
+ public static HoodieSchema createHoodieWriteSchema(HoodieSchema schema,
boolean withOperationField) {
+ ValidationUtils.checkArgument(schema != null, "Schema cannot be null");
+
+ // Convert to Avro, delegate to existing utility, convert back
+ Schema avroSchema =
HoodieAvroUtils.addMetadataFields(schema.toAvroSchema(), withOperationField);
Review Comment:
I can remove this method and use `HoodieSchemaUtils#addMetadataFields`
--
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]