linliu-code commented on code in PR #18126:
URL: https://github.com/apache/hudi/pull/18126#discussion_r2819538883
##########
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:
generateFieldMap function is only used in this file.
--
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]