nsivabalan commented on a change in pull request #3137:
URL: https://github.com/apache/hudi/pull/3137#discussion_r657602819



##########
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:
       basically can we have a test which hits this else block(231). I assume 
all tests hit line 223. schema evol tests hits 227. 




-- 
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:
us...@infra.apache.org


Reply via email to