voonhous commented on code in PR #8501: URL: https://github.com/apache/hudi/pull/8501#discussion_r1177685237
########## 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: Yes, there will not be any schema mismatches if table definitions are managed via catalogs. However, we have use cases where tables are not managed via a catalog. -- 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