xiarixiaoyao commented on a change in pull request #4910:
URL: https://github.com/apache/hudi/pull/4910#discussion_r840184594
##########
File path:
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/IncrementalRelation.scala
##########
@@ -82,21 +85,33 @@ class IncrementalRelation(val sqlContext: SQLContext,
private val commitsToReturn =
commitsTimelineToReturn.getInstants.iterator().toList
// use schema from a file produced in the end/latest instant
- val usedSchema: StructType = {
+
+ val (usedSchema, internalSchema) = {
log.info("Inferring schema..")
val schemaResolver = new TableSchemaResolver(metaClient)
- val tableSchema = if (useEndInstantSchema) {
+ val iSchema = if (useEndInstantSchema && !commitsToReturn.isEmpty) {
+
InternalSchemaCache.searchSchemaAndCache(commitsToReturn.last.getTimestamp.toLong,
metaClient, hoodieTable.getConfig.getInternalSchemaCacheEnable)
+ } else {
+ schemaResolver.getTableInternalSchemaFromCommitMetadata.orElse(null)
+ }
Review comment:
yes, you are right
--
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]