pengzhiwei2018 commented on a change in pull request #3137:
URL: https://github.com/apache/hudi/pull/3137#discussion_r657605824
##########
File path:
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/hudi/DefaultSource.scala
##########
@@ -213,11 +214,27 @@ class DefaultSource extends RelationProvider
classOf[HoodieROTablePathFilter],
classOf[org.apache.hadoop.fs.PathFilter])
+ val specifySchema = if (schema == null) {
+ // Load the schema from the commit meta data.
+ // Here we should specify the schema to the latest commit schema since
+ // the table schema evolution.
+ val schemaUtil = new TableSchemaResolver(metaClient)
+ try {
+ Some(SchemaConverters.toSqlType(schemaUtil.getTableAvroSchema)
+ .dataType.asInstanceOf[StructType])
+ } catch {
+ case _: Throwable =>
+ None // If there is no commit in the table, we can not get the
schema
+ // with schemaUtil, return None here.
+ }
+ } else {
+ None
Review comment:
The schema is null at this if-branch, so it should be None.
--
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:
[email protected]