hudi-agent commented on code in PR #19558:
URL: https://github.com/apache/hudi/pull/19558#discussion_r3737531936


##########
hudi-spark-datasource/hudi-spark4.1.x/src/main/scala/org/apache/spark/sql/adapter/Spark4_1Adapter.scala:
##########
@@ -236,6 +236,22 @@ class Spark4_1Adapter extends BaseSpark4Adapter {
     VariantMetadata.isVariantStruct(structType)
   }
 
+  override def buildFullVariantReadSchema(schema: StructType): 
Option[StructType] = {
+    var rewritten = false
+    val fields = schema.fields.map { f =>

Review Comment:
   🤖 This rewrites only top-level VariantType fields, but the row-writer 
shredding path (HoodieRowParquetWriteSupport.processNestedDataType) shreds 
variants nested inside struct/array/map columns too. Since 
clustering/compaction read the full schema with sparkRequiredSchema empty, 
wouldn't a shredded variant nested in a struct still be clipped to 
metadata+value and read null here, dropping its data on rewrite? If that is 
intentionally deferred, could you note it so it is not lost?
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



##########
hudi-spark-datasource/hudi-spark4.1.x/src/main/scala/org/apache/spark/sql/adapter/Spark4_1Adapter.scala:
##########
@@ -236,6 +236,22 @@ class Spark4_1Adapter extends BaseSpark4Adapter {
     VariantMetadata.isVariantStruct(structType)
   }
 
+  override def buildFullVariantReadSchema(schema: StructType): 
Option[StructType] = {

Review Comment:
   🤖 nit: `buildFullVariantReadSchema` is copy-pasted verbatim into 
`Spark4_2Adapter` — could this live in `BaseSpark4Adapter` instead, so future 
changes only need to happen in one place?
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



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