linliu-code commented on code in PR #17601:
URL: https://github.com/apache/hudi/pull/17601#discussion_r2742821759


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/io/storage/HoodieSparkParquetReader.java:
##########
@@ -121,35 +129,64 @@ private ClosableIterator<InternalRow> 
getInternalRowIterator(Schema readerSchema
     if (requestedSchema == null) {
       requestedSchema = readerSchema;
     }
-    StructType readerStructType = 
HoodieInternalRowUtils.getCachedSchema(readerSchema);
-    StructType requestedStructType = 
HoodieInternalRowUtils.getCachedSchema(requestedSchema);
-    storage.getConf().set(ParquetReadSupport.PARQUET_READ_SCHEMA, 
readerStructType.json());
-    storage.getConf().set(ParquetReadSupport.SPARK_ROW_REQUESTED_SCHEMA(), 
requestedStructType.json());
+
+    MessageType fileSchema = getFileSchema();
+    Schema nonNullSchema = 
AvroSchemaUtils.getNonNullTypeFromUnion(requestedSchema);
+    Option<MessageType> messageSchema = 
Option.of(getAvroSchemaConverter(storage.getConf().unwrapAs(Configuration.class)).convert(nonNullSchema));

Review Comment:
   @nsivabalan , I checked the code, the repair is applied in the 
`adapter.getReaderSchemas` implementation, since it only applied to >= spark3.4 
version.
   `    Pair<StructType, StructType> readerSchemas =
           
SparkAdapterSupport$.MODULE$.sparkAdapter().getReaderSchemas(storage, 
readerSchema, requestedSchema, fileSchema);`



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