You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2021/08/19 02:03:07 UTC

[GitHub] [hudi] danny0405 commented on a change in pull request #3465: [HUDI-1363] Provide option to drop partition columns

danny0405 commented on a change in pull request #3465:
URL: https://github.com/apache/hudi/pull/3465#discussion_r691721654



##########
File path: hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroUtils.java
##########
@@ -223,9 +223,13 @@ public static Schema addMetadataFields(Schema schema, boolean withOperationField
   }
 
   public static Schema removeMetadataFields(Schema schema) {
+    return removeFields(schema, HoodieRecord.HOODIE_META_COLUMNS);
+  }
+
+  public static Schema removeFields(Schema schema, List<String> fieldsToRemove) {
     List<Schema.Field> filteredFields = schema.getFields()
                                               .stream()
-                                              .filter(field -> !HoodieRecord.HOODIE_META_COLUMNS_WITH_OPERATION.contains(field.name()))
+                                              .filter(field -> !fieldsToRemove.contains(field.name()))
                                               .map(field -> new Schema.Field(field.name(), field.schema(), field.doc(), field.defaultVal()))

Review comment:
       Hey, is this right ? the logic is not equivalent: HoodieRecord.HOODIE_META_COLUMNS_WITH_OPERATION -> HoodieRecord.HOODIE_META_COLUMNS, i added the HoodieRecord.HOODIE_META_COLUMNS_WITH_OPERATION because when flink turns on the 'changelog mode', there is another metadata field named '_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: commits-unsubscribe@hudi.apache.org

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