voonhous commented on code in PR #8501:
URL: https://github.com/apache/hudi/pull/8501#discussion_r1178169075


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/HoodieTableFactory.java:
##########
@@ -401,4 +408,35 @@ private static void inferAvroSchema(Configuration conf, 
LogicalType rowType) {
       conf.setString(FlinkOptions.SOURCE_AVRO_SCHEMA, inferredSchema);
     }
   }
+
+  /**
+   *
+   * @param conf The configuration
+   */
+  private static void validateSourceSchema(Configuration conf) {
+    final HoodieTableMetaClient metaClient = 
StreamerUtil.metaClientForReader(conf, 
HadoopConfigurations.getHadoopConf(conf));
+    final TableSchemaResolver schemaResolver = new 
TableSchemaResolver(metaClient);
+    final Schema requiredSchema = StreamerUtil.getSourceSchema(conf);
+    final Schema srcSchema;
+
+    try {
+      srcSchema = schemaResolver.getTableAvroSchema();
+    } catch (Exception e) {
+      LOG.warn("Skipping validation for requiredSchema as table avro schema 
could not be fetched", e);
+      return;
+    }
+

Review Comment:
   @danny0405 Yeap, agree.
   
   If you feel that this PR is not required, I'll close this then. I'll apply 
it into our internal version instead. 



-- 
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-unsubscr...@hudi.apache.org

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

Reply via email to