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


##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadata.java:
##########
@@ -496,41 +503,82 @@ private HoodieData<String> repartitioningIfNeeded(
     return keys;
   }
 
-  private HoodieFileGroupReader<IndexedRecord> 
buildFileGroupReader(List<String> sortedKeys,
-                                                                    FileSlice 
fileSlice,
-                                                                    boolean 
isFullKey) {
+  private ClosableIterator<IndexedRecord> readSliceWithFilter(List<String> 
sortedKeys, FileSlice fileSlice, boolean isFullKey) throws IOException {
     Option<HoodieInstant> latestMetadataInstant =
         
metadataMetaClient.getActiveTimeline().filterCompletedInstants().lastInstant();
     String latestMetadataInstantTime =
         
latestMetadataInstant.map(HoodieInstant::requestedTime).orElse(SOLO_COMMIT_TIMESTAMP);
-    Schema schema = 
HoodieAvroUtils.addMetadataFields(HoodieMetadataRecord.getClassSchema());
     // Only those log files which have a corresponding completed instant on 
the dataset should be read
     // This is because the metadata table is updated before the dataset 
instants are committed.
     Set<String> validInstantTimestamps = getValidInstantTimestamps();
-    InstantRange instantRange = InstantRange.builder()
+    Option<InstantRange> instantRange = Option.of(InstantRange.builder()
         .rangeType(InstantRange.RangeType.EXACT_MATCH)
-        .explicitInstants(validInstantTimestamps).build();
-    
+        .explicitInstants(validInstantTimestamps).build());
+
+    // If reuse is enabled and full scan is allowed for the partition, we can 
reuse the file readers for base files and the reader context for the log files.
+    Map<StoragePath, HoodieAvroFileReader> baseFileReaders = 
Collections.emptyMap();
+    
FileGroupRecordBufferInitializer.ReusableFileGroupRecordBufferInitializer<IndexedRecord>
 recordBufferInitializer = null;
+    if (reuse && isFullScanAllowedForPartition(fileSlice.getPartitionPath())) {
+      Pair<HoodieAvroFileReader, 
FileGroupRecordBufferInitializer.ReusableFileGroupRecordBufferInitializer<IndexedRecord>>
 readers =

Review Comment:
   Makes sense.  As long as the custom instantiation is limited to this class 
and MDT reader, I'm good.



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