pengzhiwei2018 commented on a change in pull request #2334:
URL: https://github.com/apache/hudi/pull/2334#discussion_r552740514



##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieWriteHandle.java
##########
@@ -53,47 +52,70 @@
 
   private static final Logger LOG = 
LogManager.getLogger(HoodieWriteHandle.class);
 
-  protected final Schema writerSchema;
-  protected final Schema writerSchemaWithMetafields;
+  /**
+   * The table schema is the schema of the table which used to read/write 
record from table.
+   */
+  protected final Schema tableSchema;
+  /**
+   * The table schema with meta fields.
+   */
+  protected final Schema tableSchemaWithMetaFields;
+  /**
+   * The input schema is the input data schema which used to parse data from 
incoming record.
+   */
+  protected final Schema inputSchema;
+  /**
+   * The input shema with meta fields.
+   */
+  protected final Schema inputSchemaWithMetaFields;
+
   protected HoodieTimer timer;
   protected final WriteStatus writeStatus;
   protected final String partitionPath;
   protected final String fileId;
   protected final String writeToken;
   protected final TaskContextSupplier taskContextSupplier;
 
-  public HoodieWriteHandle(HoodieWriteConfig config, String instantTime, 
String partitionPath,
-                           String fileId, HoodieTable<T, I, K, O> hoodieTable, 
TaskContextSupplier taskContextSupplier) {
-    this(config, instantTime, partitionPath, fileId, hoodieTable,
-        getWriterSchemaIncludingAndExcludingMetadataPair(config), 
taskContextSupplier);
-  }
+  /**
+   *
+   * @param config the write config
+   * @param instantTime the instance time
+   * @param partitionPath the partition path
+   * @param fileId the file id
+   * @param hoodieTable the hoodie table
+   * @param schemaOption the option schema specified for HoodieBootstrapHandle
+   * @param taskContextSupplier
+   */
+  protected HoodieWriteHandle(HoodieWriteConfig config, String instantTime, 
String partitionPath,
+                           String fileId, HoodieTable<T, I, K, O> hoodieTable,
+                           Option<Schema> schemaOption,
+                           TaskContextSupplier taskContextSupplier) {
 
-  protected HoodieWriteHandle(HoodieWriteConfig config, String instantTime, 
String partitionPath, String fileId,
-                              HoodieTable<T, I, K, O> hoodieTable, 
Pair<Schema, Schema> writerSchemaIncludingAndExcludingMetadataPair,
-                              TaskContextSupplier taskContextSupplier) {
     super(config, instantTime, hoodieTable);
     this.partitionPath = partitionPath;
     this.fileId = fileId;
-    this.writerSchema = writerSchemaIncludingAndExcludingMetadataPair.getKey();
-    this.writerSchemaWithMetafields = 
writerSchemaIncludingAndExcludingMetadataPair.getValue();
+    // Here the hoodieTable#config may not equal to the config field, we use 
the 'config' from the
+    // construct method
+    this.tableSchema = schemaOption.orElseGet(() -> 
hoodieTable.getTableSchema(config, false));

Review comment:
       Yes @nsivabalan ,the `schemaOption` is only used for 
`HoodieBootstrapHandle` to pass it's schema.




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

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


Reply via email to