xiarixiaoyao commented on a change in pull request #3668:
URL: https://github.com/apache/hudi/pull/3668#discussion_r717261334



##########
File path: 
hudi-common/src/main/java/org/apache/hudi/common/table/log/AbstractHoodieLogRecordScanner.java
##########
@@ -311,6 +319,12 @@ private boolean isNewInstantBlock(HoodieLogBlock logBlock) 
{
   private void processDataBlock(HoodieDataBlock dataBlock) throws Exception {
     // TODO (NA) - Implement getRecordItr() in HoodieAvroDataBlock and use 
that here
     List<IndexedRecord> recs = dataBlock.getRecords();
+    if (internalSchema != null) {
+      Long currentTime = 
Long.parseLong(dataBlock.getLogBlockHeader().get(INSTANT_TIME));
+      InternalSchema fileSchema = 
TableInternalSchemaUtils.searchSchemaAndCache(currentTime, path, fs.getConf());
+      Schema readSchema = 
AvroSchemaUtil.convert(InternalSchemaUtils.mergeSchema(fileSchema, 
internalSchema), readerSchema != null ? readerSchema.getName() : "tableName");
+      recs = recs.stream().map(rec -> 
AvroSchemaUtil.rewriteRecord((GenericRecord) rec, 
readSchema)).collect(Collectors.toList());

Review comment:
       yes




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