dossett commented on code in PR #3674:
URL: https://github.com/apache/parquet-java/pull/3674#discussion_r3606053510
##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetInputFormat.java:
##########
@@ -485,15 +487,48 @@ public List<Footer> getFooters(JobContext jobContext)
throws IOException {
if (footer == null) {
// Footer was originally missing, so get it from the cache again
-
footers.add(footersCache.getCurrentValue(footerEntry.getKey()).getFooter());
- } else {
- footers.add(footer);
+ footer =
footersCache.getCurrentValue(footerEntry.getKey()).getFooter();
}
+ footers.add(new FooterWithFileStatus(footer,
footerEntry.getKey().status));
}
return footers;
}
+ static FileStatus getFileStatus(Footer footer) {
+ return footer instanceof FooterWithFileStatus ? ((FooterWithFileStatus)
footer).fileStatus : null;
+ }
+
+ private static Footer withoutFileStatus(Footer footer) {
+ return footer instanceof FooterWithFileStatus
+ ? new Footer(footer.getFile(), footer.getParquetMetadata())
+ : footer;
+ }
+
+ private static List<Footer> withFileStatuses(List<Footer> footers,
Collection<FileStatus> statuses) {
+ Map<Path, FileStatus> statusesByPath = new HashMap<Path,
FileStatus>(statuses.size());
+ for (FileStatus status : statuses) {
+ statusesByPath.put(status.getPath(), status);
+ }
+
+ List<Footer> footersWithStatuses = new ArrayList<Footer>(footers.size());
+ for (Footer footer : footers) {
+ FileStatus status = statusesByPath.get(footer.getFile());
+ footersWithStatuses.add(status == null ? footer : new
FooterWithFileStatus(footer, status));
+ }
+ return footersWithStatuses;
+ }
+
+ /** Carries an already-listed status through split planning without adding
it to Footer's public API. */
+ private static final class FooterWithFileStatus extends Footer {
Review Comment:
If we were on Java 17 this would just be a `record` to carry the Footer and
FileStatus together.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]