From 036cef946eb0f006a3d8c2e8397bf3c149d9ac0c Mon Sep 17 00:00:00 2001 From: Fokko Driesprong Date: Thu, 5 Oct 2023 21:51:37 +0200 Subject: [PATCH] Spec: Inconsistency around files_count (#5338) --- .../java/org/apache/iceberg/ManifestFile.java | 6 ++--- .../iceberg/TestManifestListVersions.java | 26 +++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/api/src/main/java/org/apache/iceberg/ManifestFile.java b/api/src/main/java/org/apache/iceberg/ManifestFile.java index 7581538d87b4..ee38a6d4140a 100644 --- a/api/src/main/java/org/apache/iceberg/ManifestFile.java +++ b/api/src/main/java/org/apache/iceberg/ManifestFile.java @@ -52,11 +52,11 @@ public interface ManifestFile { optional( 503, "added_snapshot_id", Types.LongType.get(), "Snapshot ID that added the manifest"); Types.NestedField ADDED_FILES_COUNT = - optional(504, "added_data_files_count", Types.IntegerType.get(), "Added entry count"); + optional(504, "added_files_count", Types.IntegerType.get(), "Added entry count"); Types.NestedField EXISTING_FILES_COUNT = - optional(505, "existing_data_files_count", Types.IntegerType.get(), "Existing entry count"); + optional(505, "existing_files_count", Types.IntegerType.get(), "Existing entry count"); Types.NestedField DELETED_FILES_COUNT = - optional(506, "deleted_data_files_count", Types.IntegerType.get(), "Deleted entry count"); + optional(506, "deleted_files_count", Types.IntegerType.get(), "Deleted entry count"); Types.NestedField ADDED_ROWS_COUNT = optional(512, "added_rows_count", Types.LongType.get(), "Added rows count"); Types.NestedField EXISTING_ROWS_COUNT = diff --git a/core/src/test/java/org/apache/iceberg/TestManifestListVersions.java b/core/src/test/java/org/apache/iceberg/TestManifestListVersions.java index a95379e4ca33..5b8df081c3c2 100644 --- a/core/src/test/java/org/apache/iceberg/TestManifestListVersions.java +++ b/core/src/test/java/org/apache/iceberg/TestManifestListVersions.java @@ -163,12 +163,11 @@ public void testV1ForwardCompatibility() throws IOException { Assert.assertEquals("Length", LENGTH, generic.get("manifest_length")); Assert.assertEquals("Spec id", SPEC_ID, generic.get("partition_spec_id")); Assert.assertEquals("Snapshot id", SNAPSHOT_ID, (long) generic.get("added_snapshot_id")); + Assert.assertEquals("Added files count", ADDED_FILES, (int) generic.get("added_files_count")); Assert.assertEquals( - "Added files count", ADDED_FILES, (int) generic.get("added_data_files_count")); + "Existing files count", EXISTING_FILES, (int) generic.get("existing_files_count")); Assert.assertEquals( - "Existing files count", EXISTING_FILES, (int) generic.get("existing_data_files_count")); - Assert.assertEquals( - "Deleted files count", DELETED_FILES, (int) generic.get("deleted_data_files_count")); + "Deleted files count", DELETED_FILES, (int) generic.get("deleted_files_count")); Assert.assertEquals("Added rows count", ADDED_ROWS, (long) generic.get("added_rows_count")); Assert.assertEquals( "Existing rows count", EXISTING_ROWS, (long) generic.get("existing_rows_count")); @@ -191,12 +190,11 @@ public void testV2ForwardCompatibility() throws IOException { Assert.assertEquals("Length", LENGTH, generic.get("manifest_length")); Assert.assertEquals("Spec id", SPEC_ID, generic.get("partition_spec_id")); Assert.assertEquals("Snapshot id", SNAPSHOT_ID, (long) generic.get("added_snapshot_id")); + Assert.assertEquals("Added files count", ADDED_FILES, (int) generic.get("added_files_count")); Assert.assertEquals( - "Added files count", ADDED_FILES, (int) generic.get("added_data_files_count")); - Assert.assertEquals( - "Existing files count", EXISTING_FILES, (int) generic.get("existing_data_files_count")); + "Existing files count", EXISTING_FILES, (int) generic.get("existing_files_count")); Assert.assertEquals( - "Deleted files count", DELETED_FILES, (int) generic.get("deleted_data_files_count")); + "Deleted files count", DELETED_FILES, (int) generic.get("deleted_files_count")); Assert.assertEquals("Added rows count", ADDED_ROWS, (long) generic.get("added_rows_count")); Assert.assertEquals( "Existing rows count", EXISTING_ROWS, (long) generic.get("existing_rows_count")); @@ -218,9 +216,9 @@ public void testManifestsWithoutRowStats() throws IOException { "manifest_length", "partition_spec_id", "added_snapshot_id", - "added_data_files_count", - "existing_data_files_count", - "deleted_data_files_count", + "added_files_count", + "existing_files_count", + "deleted_files_count", "partitions"); Schema schemaWithoutRowStats = V1Metadata.MANIFEST_LIST_SCHEMA.select(columnNamesWithoutRowStats); @@ -241,9 +239,9 @@ public void testManifestsWithoutRowStats() throws IOException { .set("manifest_length", 1024L) .set("partition_spec_id", 1) .set("added_snapshot_id", 100L) - .set("added_data_files_count", 2) - .set("existing_data_files_count", 3) - .set("deleted_data_files_count", 4) + .set("added_files_count", 2) + .set("existing_files_count", 3) + .set("deleted_files_count", 4) .set("partitions", null) .build(); appender.add(withoutRowStats);