rahil-c commented on code in PR #17573:
URL: https://github.com/apache/hudi/pull/17573#discussion_r2632392884


##########
hudi-common/src/main/java/org/apache/hudi/common/schema/HoodieSchemaUtils.java:
##########
@@ -307,6 +325,31 @@ public static HoodieSchemaField 
createNewSchemaField(String name, HoodieSchema s
     return HoodieSchemaField.fromAvroField(avroField);
   }
 
+  /**
+   * Creates a new schema field with the specified properties, including field 
order.
+   * This is equivalent to HoodieAvroUtils.createNewSchemaField() but returns 
HoodieSchemaField.
+   *
+   * @param name         field name
+   * @param schema       field schema
+   * @param doc          field documentation (can be null)
+   * @param defaultValue default value (can be null)
+   * @param order        field order for sorting
+   * @return new HoodieSchemaField instance
+   * @throws IllegalArgumentException if name, schema, or order is null/empty
+   * @since 1.2.0
+   */
+  public static HoodieSchemaField createNewSchemaField(String name, 
HoodieSchema schema,
+                                                       String doc, Object 
defaultValue, HoodieFieldOrder order) {
+    ValidationUtils.checkArgument(name != null && !name.isEmpty(), "Field name 
cannot be null or empty");
+    ValidationUtils.checkArgument(schema != null, "Field schema cannot be 
null");
+    ValidationUtils.checkArgument(order != null, "Field order cannot be null");
+
+    // Delegate to HoodieAvroUtils
+    Schema.Field avroField = HoodieAvroUtils.createNewSchemaField(
+        name, schema.toAvroSchema(), doc, defaultValue, order.toAvroOrder());
+    return HoodieSchemaField.fromAvroField(avroField);
+  }

Review Comment:
   @yihua aligned with ethan here we can keep this for now



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