aokolnychyi commented on a change in pull request #675: Inherit snapshot ids
for manifest entries
URL: https://github.com/apache/incubator-iceberg/pull/675#discussion_r364792835
##########
File path: core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java
##########
@@ -203,20 +204,22 @@ protected void add(DataFile file) {
* Add all files in a manifest to the new snapshot.
*/
protected void add(ManifestFile manifest) {
- // the manifest must be rewritten with this update's snapshot ID
- try (ManifestReader reader = ManifestReader.read(
- ops.io().newInputFile(manifest.path()), ops.current().specsById())) {
- ManifestFile manifestFile = ManifestWriter.copyAppendManifest(
- reader, manifestPath(manifestCount.getAndIncrement()), snapshotId(),
appendedManifestsSummary);
- appendManifests.add(manifestFile);
- // keep reference of the first appended manifest, so that we can avoid
merging first bin(s)
- // which has the first appended manifest and have not crossed the limit
of minManifestsCountToMerge
- if (firstAppendedManifest == null) {
- firstAppendedManifest = manifestFile;
+ // TODO: avoid reading manifests to simply get stats
+ try (ManifestReader reader = ManifestReader.read(manifest, ops.io(),
ops.current().specsById())) {
+ for (ManifestEntry addedEntry : reader.addedFiles()) {
+ appendedManifestsSummary.addedFile(reader.spec(), addedEntry.file());
}
} catch (IOException e) {
throw new RuntimeIOException(e, "Failed to close manifest: %s",
manifest);
}
+
+ appendManifests.add(manifest);
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]