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


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/SparkHoodieTableFileIndex.scala:
##########
@@ -134,8 +134,11 @@ class SparkHoodieTableFileIndex(spark: SparkSession,
         val partitionFields: Array[StructField] = 
partitionColumns.get().map(column => StructField(column, StringType))
         StructType(partitionFields)
       } else {
+        // Use full partition path (e.g. "nested_record.level") as the 
partition column name so that
+        // data schema does not exclude a same-named top-level column (e.g. 
"level") when partition
+        // path is a nested field. Otherwise partition value would overwrite 
the data column on read.
         val partitionFields: Array[StructField] = 
partitionColumns.get().filter(column => nameFieldMap.contains(column))
-          .map(column => nameFieldMap.apply(column))
+          .map(column => StructField(column, 
nameFieldMap.apply(column).dataType))

Review Comment:
   That's why `generateFieldMap` should be fixed.  If the output of 
`generateFieldMap` function needs further processing, that defeats the purpose 
of the function itself.



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

Reply via email to