zhuxiangyi commented on code in PR #10394:
URL: https://github.com/apache/paimon/pull/10394#discussion_r4291829205
##########
paimon-core/src/main/java/org/apache/paimon/operation/DataEvolutionSplitRead.java:
##########
@@ -305,14 +324,41 @@ private RecordReader<InternalRow> createReader(
groupSelection =
buildGroupSelection(needMergeFiles,
fileIndexResults);
}
- return createUnionReader(
- needMergeFiles,
- partition,
- dataFilePathFactory,
- rowRanges,
- readRowType,
- deletionVector,
- groupSelection);
+ FileMetadataCache metadataCache = new
FileMetadataCache();
+ List<Range> candidates =
+ candidateRanges(
+ filters,
+ needMergeFiles,
+ dataFilePathFactory,
+ metadataCache);
+ // Candidates restrict the group selection, not
the row ranges of the
+ // split, which also decide whether a row sidecar
is read instead.
+ if (candidates != null) {
+ if (candidates.isEmpty()) {
+ return new EmptyFileRecordReader<>();
+ }
+ groupSelection =
+ restrictToCandidates(
+ groupSelection,
needMergeFiles.get(0), candidates);
+ if (isSelectionEmpty(
+ needMergeFiles.get(0), rowRanges,
groupSelection)) {
+ return new EmptyFileRecordReader<>();
+ }
+ }
+ // the readers of a group are created right away,
see #candidateRanges
+ groupMetadataCache = metadataCache;
Review Comment:
Done in 65d77e2fd7: the cache is created per merged group and passed
explicitly through `createUnionReader` → `createFieldBunchReader` →
`createFileReader`, so the instance field and the `try/finally` are gone. Only
the normal-file path uses it; the single-file, blob and vector paths pass null.
`testFooterReadOncePerFile` checks that each file of a merged group reads its
footer once.
--
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]