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/21 03:23:29 UTC

[GitHub] [hudi] nsivabalan commented on a diff in pull request #5379: [HUDI-3936] Fix projection for a nested field as pre-combined key

nsivabalan commented on code in PR #5379:
URL: https://github.com/apache/hudi/pull/5379#discussion_r854743124


##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/hudi/HoodieSparkUtils.scala:
##########
@@ -322,7 +323,9 @@ object HoodieSparkUtils extends SparkAdapterSupport {
       val name2Fields = tableAvroSchema.getFields.asScala.map(f => f.name() -> f).toMap
       // Here have to create a new Schema.Field object
       // to prevent throwing exceptions like "org.apache.avro.AvroRuntimeException: Field already used".
-      val requiredFields = requiredColumns.map(c => name2Fields(c))
+      // For a nested field, we include the root-level field
+      val requiredFields = requiredColumns.map(c => HoodieAvroUtils.getRootLevelFieldName(c))
+        .distinct.map(c => name2Fields(c))

Review Comment:
   just MOR. 



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