Conversation
Author
|
@ebyhr @szehon-ho Please review the PR when you have time. Thank you. |
mkroll-db
reviewed
Sep 21, 2026
Comment on lines
+81
to
+114
| private BaseEntriesTable.ManifestReadTask createTask() { | ||
| Schema schema = TestBase.SCHEMA; | ||
| HadoopFileIO fileIO = new HadoopFileIO(); | ||
| fileIO.initialize(ImmutableMap.of("k1", "v1", "k2", "v2")); | ||
| Map<Integer, PartitionSpec> specsById = | ||
| PartitionUtil.indexSpecs( | ||
| Arrays.asList(PartitionSpec.builderFor(schema).bucket("data", 16).build())); | ||
| ManifestFile manifestFile = TestManifestFileParser.createManifestFile(); | ||
| return new BaseEntriesTable.ManifestReadTask( | ||
| schema, fileIO, specsById, manifestFile, schema, Expressions.equal("id", 1)); | ||
| } | ||
|
|
||
| private String taskJson() { | ||
| return "{\"task-type\":\"manifest-entries-task\"," | ||
| + "\"schema\":{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{" | ||
| + "\"id\":3,\"name\":\"id\",\"required\":true,\"type\":\"int\"}," | ||
| + "{\"id\":4,\"name\":\"data\",\"required\":true,\"type\":\"string\"}]}," | ||
| + "\"file-io\":{\"io-impl\":\"org.apache.iceberg.hadoop.HadoopFileIO\"," | ||
| + "\"properties\":{\"k1\":\"v1\",\"k2\":\"v2\"}}," | ||
| + "\"partition-specs\":[{\"spec-id\":0,\"fields\":[{" | ||
| + "\"name\":\"data_bucket\",\"transform\":\"bucket[16]\",\"source-id\":4,\"field-id\":1000}]}]," | ||
| + "\"manifest-file\":{\"path\":\"/path/input.m0.avro\"," | ||
| + "\"length\":5878,\"partition-spec-id\":0,\"content\":0,\"sequence-number\":1,\"min-sequence-number\":2," | ||
| + "\"added-snapshot-id\":12345678901234567," | ||
| + "\"added-files-count\":1,\"existing-files-count\":3,\"deleted-files-count\":0," | ||
| + "\"added-rows-count\":10,\"existing-rows-count\":30,\"deleted-rows-count\":0," | ||
| + "\"partition-field-summary\":[{\"contains-null\":true,\"contains-nan\":false," | ||
| + "\"lower-bound\":\"0A000000\",\"upper-bound\":\"64000000\"}],\"key-metadata\":\"DB030000\"," | ||
| + "\"first-row-id\":10}," | ||
| + "\"projection\":{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{" | ||
| + "\"id\":3,\"name\":\"id\",\"required\":true,\"type\":\"int\"}," | ||
| + "{\"id\":4,\"name\":\"data\",\"required\":true,\"type\":\"string\"}]}," | ||
| + "\"residual-filter\":{\"type\":\"eq\",\"term\":\"id\",\"value\":1}}"; | ||
| } |
There was a problem hiding this comment.
Two suggestions to strengthen the round-trip test:
- Use a projection that differs from the table schema.
- Include two partition specs to verify collection serialization and deserialization.
Suggested change
| private BaseEntriesTable.ManifestReadTask createTask() { | |
| Schema schema = TestBase.SCHEMA; | |
| HadoopFileIO fileIO = new HadoopFileIO(); | |
| fileIO.initialize(ImmutableMap.of("k1", "v1", "k2", "v2")); | |
| Map<Integer, PartitionSpec> specsById = | |
| PartitionUtil.indexSpecs( | |
| Arrays.asList(PartitionSpec.builderFor(schema).bucket("data", 16).build())); | |
| ManifestFile manifestFile = TestManifestFileParser.createManifestFile(); | |
| return new BaseEntriesTable.ManifestReadTask( | |
| schema, fileIO, specsById, manifestFile, schema, Expressions.equal("id", 1)); | |
| } | |
| private String taskJson() { | |
| return "{\"task-type\":\"manifest-entries-task\"," | |
| + "\"schema\":{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{" | |
| + "\"id\":3,\"name\":\"id\",\"required\":true,\"type\":\"int\"}," | |
| + "{\"id\":4,\"name\":\"data\",\"required\":true,\"type\":\"string\"}]}," | |
| + "\"file-io\":{\"io-impl\":\"org.apache.iceberg.hadoop.HadoopFileIO\"," | |
| + "\"properties\":{\"k1\":\"v1\",\"k2\":\"v2\"}}," | |
| + "\"partition-specs\":[{\"spec-id\":0,\"fields\":[{" | |
| + "\"name\":\"data_bucket\",\"transform\":\"bucket[16]\",\"source-id\":4,\"field-id\":1000}]}]," | |
| + "\"manifest-file\":{\"path\":\"/path/input.m0.avro\"," | |
| + "\"length\":5878,\"partition-spec-id\":0,\"content\":0,\"sequence-number\":1,\"min-sequence-number\":2," | |
| + "\"added-snapshot-id\":12345678901234567," | |
| + "\"added-files-count\":1,\"existing-files-count\":3,\"deleted-files-count\":0," | |
| + "\"added-rows-count\":10,\"existing-rows-count\":30,\"deleted-rows-count\":0," | |
| + "\"partition-field-summary\":[{\"contains-null\":true,\"contains-nan\":false," | |
| + "\"lower-bound\":\"0A000000\",\"upper-bound\":\"64000000\"}],\"key-metadata\":\"DB030000\"," | |
| + "\"first-row-id\":10}," | |
| + "\"projection\":{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{" | |
| + "\"id\":3,\"name\":\"id\",\"required\":true,\"type\":\"int\"}," | |
| + "{\"id\":4,\"name\":\"data\",\"required\":true,\"type\":\"string\"}]}," | |
| + "\"residual-filter\":{\"type\":\"eq\",\"term\":\"id\",\"value\":1}}"; | |
| } | |
| private BaseEntriesTable.ManifestReadTask createTask() { | |
| Schema schema = TestBase.SCHEMA; | |
| Schema projection = schema.select("data"); | |
| HadoopFileIO fileIO = new HadoopFileIO(); | |
| fileIO.initialize(ImmutableMap.of("k1", "v1", "k2", "v2")); | |
| Map<Integer, PartitionSpec> specsById = | |
| PartitionUtil.indexSpecs( | |
| Arrays.asList( | |
| PartitionSpec.builderFor(schema).bucket("data", 16).build(), | |
| PartitionSpec.builderFor(schema).withSpecId(1).bucket("id", 4).build())); | |
| ManifestFile manifestFile = TestManifestFileParser.createManifestFile(); | |
| return new BaseEntriesTable.ManifestReadTask( | |
| schema, fileIO, specsById, manifestFile, projection, Expressions.equal("id", 1)); | |
| } | |
| private String taskJson() { | |
| return "{\"task-type\":\"manifest-entries-task\"," | |
| + "\"schema\":{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{" | |
| + "\"id\":3,\"name\":\"id\",\"required\":true,\"type\":\"int\"}," | |
| + "{\"id\":4,\"name\":\"data\",\"required\":true,\"type\":\"string\"}]}," | |
| + "\"file-io\":{\"io-impl\":\"org.apache.iceberg.hadoop.HadoopFileIO\"," | |
| + "\"properties\":{\"k1\":\"v1\",\"k2\":\"v2\"}}," | |
| + "\"partition-specs\":[{\"spec-id\":0,\"fields\":[{" | |
| + "\"name\":\"data_bucket\",\"transform\":\"bucket[16]\",\"source-id\":4,\"field-id\":1000}]}," | |
| + "{\"spec-id\":1,\"fields\":[{" | |
| + "\"name\":\"id_bucket\",\"transform\":\"bucket[4]\",\"source-id\":3,\"field-id\":1000}]}]," | |
| + "\"manifest-file\":{\"path\":\"/path/input.m0.avro\"," | |
| + "\"length\":5878,\"partition-spec-id\":0,\"content\":0,\"sequence-number\":1,\"min-sequence-number\":2," | |
| + "\"added-snapshot-id\":12345678901234567," | |
| + "\"added-files-count\":1,\"existing-files-count\":3,\"deleted-files-count\":0," | |
| + "\"added-rows-count\":10,\"existing-rows-count\":30,\"deleted-rows-count\":0," | |
| + "\"partition-field-summary\":[{\"contains-null\":true,\"contains-nan\":false," | |
| + "\"lower-bound\":\"0A000000\",\"upper-bound\":\"64000000\"}],\"key-metadata\":\"DB030000\"," | |
| + "\"first-row-id\":10}," | |
| + "\"projection\":{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{" | |
| + "\"id\":4,\"name\":\"data\",\"required\":true,\"type\":\"string\"}]}," | |
| + "\"residual-filter\":{\"type\":\"eq\",\"term\":\"id\",\"value\":1}}"; | |
| } |
Author
There was a problem hiding this comment.
@mkroll-db, Thank you, great suggestions - applied both. Using a projection that differs from the table schema (data only) and adding a second partition spec makes the round-trip actually verify that the projection and the spec collection are serialized/deserialized independently, rather than passing coincidentally.
Verified locally: test green, spotless and checkstyle clean. Appreciate the review...
…skParser round-trip test
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added UTs for
ManifestEntriesTableTaskParser, which previously had no test coverage.The test file
TestManifestEntriesTableTaskParsermirrors the existing testTestFilesTableTaskParser:nullCheck— validates thetoJson/fromJsonprecondition guards.invalidJsonNode— validates rejection of non-object JSON nodes.testParser— full round-trip throughScanTaskParser(task → JSON → task),asserting both the serialized JSON and field-by-field task equality.