Blazer-007 commented on code in PR #4058: URL: https://github.com/apache/gobblin/pull/4058#discussion_r1804100436
########## gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/iceberg/IcebergTable.java: ########## @@ -217,4 +227,59 @@ protected void registerIcebergTable(TableMetadata srcMetadata, TableMetadata dst this.tableOps.commit(dstMetadata, srcMetadata); } } + + /** + * Retrieves a list of data files from the current snapshot that match the specified partition filter predicate. + * + * @param icebergPartitionFilterPredicate the predicate to filter partitions + * @return a list of data files that match the partition filter predicate + * @throws IOException if an I/O error occurs while accessing the table metadata or reading manifest files + */ + public List<DataFile> getPartitionSpecificDataFiles(Predicate<StructLike> icebergPartitionFilterPredicate) throws IOException { + TableMetadata tableMetadata = accessTableMetadata(); + Snapshot currentSnapshot = tableMetadata.currentSnapshot(); + log.info("Starting to copy data files from snapshot: {}", currentSnapshot.snapshotId()); + //TODO: Add support for deleteManifests as well later + // Currently supporting dataManifests only + List<ManifestFile> dataManifestFiles = currentSnapshot.dataManifests(this.tableOps.io()); + List<DataFile> dataFileList = new ArrayList<>(); + for (ManifestFile manifestFile : dataManifestFiles) { + try (ManifestReader<DataFile> manifestReader = ManifestFiles.read(manifestFile, this.tableOps.io()); + CloseableIterator<DataFile> dataFiles = manifestReader.iterator()) { + dataFiles.forEachRemaining(dataFile -> { + if (icebergPartitionFilterPredicate.test(dataFile.partition())) { + dataFileList.add(dataFile.copy()); + } + }); + } catch (IOException e) { + log.warn("Failed to read manifest file: {} " , manifestFile.path(), e); + } Review Comment: yeah completely agree with your suggestion, somehow i missed it let me correct it by failing the copy with proper logging -- 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: dev-unsubscr...@gobblin.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org