danny0405 commented on code in PR #19205:
URL: https://github.com/apache/hudi/pull/19205#discussion_r3782735888


##########
hudi-hadoop-common/src/main/java/org/apache/hudi/io/storage/hadoop/HoodieAvroParquetWriter.java:
##########
@@ -48,39 +51,77 @@ public class HoodieAvroParquetWriter
   private final String fileName;
   private final String instantTime;
   private final TaskContextSupplier taskContextSupplier;
-  private final boolean populateMetaFields;
+  private final MetaFieldsMode metaFieldsMode;
   private final HoodieAvroWriteSupport writeSupport;
 
+  /**
+   * @deprecated since 1.3.0, use the {@link MetaFieldsMode} overload. 
Retained for existing callers
+   * that only distinguish all-or-nothing meta fields ({@code true} maps to 
{@link MetaFieldsMode#ALL},
+   * {@code false} to {@link MetaFieldsMode#NONE}); it cannot express the 
selective modes.
+   */
+  @Deprecated
   @SuppressWarnings({"unchecked", "rawtypes"})
   public HoodieAvroParquetWriter(StoragePath file,
                                  HoodieParquetConfig<HoodieAvroWriteSupport> 
parquetConfig,
                                  String instantTime,
                                  TaskContextSupplier taskContextSupplier,
                                  boolean populateMetaFields) throws 
IOException {
+    this(file, parquetConfig, instantTime, taskContextSupplier,
+        populateMetaFields ? MetaFieldsMode.ALL : MetaFieldsMode.NONE);
+  }
+
+  @SuppressWarnings({"unchecked", "rawtypes"})
+  public HoodieAvroParquetWriter(StoragePath file,
+                                 HoodieParquetConfig<HoodieAvroWriteSupport> 
parquetConfig,
+                                 String instantTime,
+                                 TaskContextSupplier taskContextSupplier,
+                                 MetaFieldsMode metaFieldsMode) throws 
IOException {
     super(file, (HoodieParquetConfig) parquetConfig);
     this.fileName = file.getName();
     this.writeSupport = parquetConfig.getWriteSupport();
     this.instantTime = instantTime;
     this.taskContextSupplier = taskContextSupplier;
-    this.populateMetaFields = populateMetaFields;
+    this.metaFieldsMode = metaFieldsMode == null ? MetaFieldsMode.NONE : 
metaFieldsMode;

Review Comment:
   the write handles deem null as `ALL` through `MetaFieldsMode.orAllIfUnknown` 
while here the null equals `NONE`, is this even consistent?



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