You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/04/26 02:38:37 UTC

[GitHub] [hudi] yihua commented on a diff in pull request #5430: [WIP][Stacked on 5428] Optimize out mandatory columns when no merging is performed

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-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org