the-other-tim-brown commented on code in PR #10342:
URL: https://github.com/apache/hudi/pull/10342#discussion_r1429204766


##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/streamer/StreamSync.java:
##########
@@ -998,9 +996,9 @@ public void runMetaSync() {
    * this constraint.
    */
   private void setupWriteClient(Option<JavaRDD<HoodieRecord>> recordsOpt) 
throws IOException {
-    if ((null != schemaProvider)) {
+    if (null != schemaProvider) {
       Schema sourceSchema = schemaProvider.getSourceSchema();
-      Schema targetSchema = schemaProvider.getTargetSchema();
+      Schema targetSchema = 
getSchemaForWriteConfig(schemaProvider.getTargetSchema());

Review Comment:
   We don't call `getSchemaForWriteConfig` from `reInitWriteClient()`. There is 
a call to `getHoodieClientConfig` that takes in a schema that must be non-null 
to hit the `getSchemaForWriteConfig` path though. 
   
   I think one way to simplify this is to make this call always happen if the 
schema is required in the config. When we initialize the StreamSync class, we 
will pass in some schema or null potentially but I don't think we really even 
need the writer schema for this case and want to avoid a read from the 
filesystem if possible to fetch the latest commit schema. If you agree, I can 
clean this up so that `getHoodieClientConfig` takes in a schema and a boolean 
indicating whether the schema must be set in the config.



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