Skip to content

Commit

Permalink
Spec: Inconsistency around files_count (#5338)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko authored Oct 5, 2023
1 parent dd26f36 commit 036cef9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
6 changes: 3 additions & 3 deletions api/src/main/java/org/apache/iceberg/ManifestFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
26 changes: 12 additions & 14 deletions core/src/test/java/org/apache/iceberg/TestManifestListVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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"));
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 036cef9

Please sign in to comment.