yihua commented on code in PR #5430:
URL: https://github.com/apache/hudi/pull/5430#discussion_r858186088


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/MergeOnReadSnapshotRelation.scala:
##########
@@ -144,6 +186,15 @@ class MergeOnReadSnapshotRelation(sqlContext: SQLContext,
       fsView.getLatestMergedFileSlicesBeforeOrOn(relativePath, 
queryTimestamp).iterator().asScala.toSeq
     }
   }
+
+  protected def pruneSchemaForMergeSkipping(requiredSchema: 
HoodieTableSchema): HoodieTableSchema = {
+    val mandatoryFieldNames = mandatoryFields.map(fieldName => 
HoodieAvroUtils.getRootLevelFieldName(fieldName))
+    val prunedStructSchema = StructType(
+      requiredSchema.structTypeSchema.fields.filterNot(f => 
mandatoryFieldNames.contains(f.name))
+    )

Review Comment:
   We should not exclude the root fields from `mandatoryFieldNames` since the 
query columns may also contain the same root field.



-- 
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

Reply via email to