cshuo commented on code in PR #12967:
URL: https://github.com/apache/hudi/pull/12967#discussion_r1998777638


##########
hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroUtils.java:
##########
@@ -311,25 +311,42 @@ public static Schema addMetadataFields(Schema schema) {
    * @param withOperationField Whether to include the '_hoodie_operation' field
    */
   public static Schema addMetadataFields(Schema schema, boolean 
withOperationField) {
-    int newFieldsSize = HoodieRecord.HOODIE_META_COLUMNS.size() + 
(withOperationField ? 1 : 0);
+    return addMetadataFields(schema, true, withOperationField);
+  }
+
+  /**
+   * Adds the Hoodie metadata fields to the given schema.
+   *
+   * @param schema               The schema
+   * @param isPopulateMetaFields Whether to include metadata fields
+   * @param withOperationField   Whether to include the '_hoodie_operation' 
field
+   */
+  public static Schema addMetadataFields(Schema schema, boolean 
isPopulateMetaFields, boolean withOperationField) {

Review Comment:
   there are 6 meta fields currently, the preservation of the first 5 fields 
are controlled by option `hoodie.populate.meta.fields` and `_hoodie_operation` 
field is controlled by option `hoodie.allow.operation.metadata.field`. During 
writing log files, both options can be true or false.
   ```
       COMMIT_TIME_METADATA_FIELD("_hoodie_commit_time"),
       COMMIT_SEQNO_METADATA_FIELD("_hoodie_commit_seqno"),
       RECORD_KEY_METADATA_FIELD("_hoodie_record_key"),
       PARTITION_PATH_METADATA_FIELD("_hoodie_partition_path"),
       FILENAME_METADATA_FIELD("_hoodie_file_name"),
       OPERATION_METADATA_FIELD("_hoodie_operation");
   ```



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