danny0405 commented on code in PR #8501:
URL: https://github.com/apache/hudi/pull/8501#discussion_r1177909927
##########
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:
Reasonable, but restraict the entrence of the SQL queries is another way to
mediate the issue, do you agree?
--
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]