rdblue commented on a change in pull request #750: Add time-travel methods
(asOfTime,useSnapshot) in IcebergGenerics
URL: https://github.com/apache/incubator-iceberg/pull/750#discussion_r371377849
##########
File path: data/src/test/java/org/apache/iceberg/data/TestLocalScan.java
##########
@@ -114,53 +122,105 @@ public void createTables() throws IOException {
Record record = GenericRecord.create(SCHEMA);
- this.file1Records = Lists.newArrayList(
+ this.file1FirstSnapshotRecords = Lists.newArrayList(
+ record.copy(ImmutableMap.of("id", 4L, "data", "obscure")),
+ record.copy(ImmutableMap.of("id", 5L, "data", "secure")),
+ record.copy(ImmutableMap.of("id", 6L, "data", "fetta"))
+ );
+ InputFile file11 = writeFile(sharedTableLocation,
format.addExtension("file-11"), file1FirstSnapshotRecords);
+
+ this.file2FirstSnapshotRecords = Lists.newArrayList(
+ record.copy(ImmutableMap.of("id", 14L, "data", "radical")),
+ record.copy(ImmutableMap.of("id", 15L, "data", "collocation")),
+ record.copy(ImmutableMap.of("id", 16L, "data", "book"))
+ );
+ InputFile file21 = writeFile(sharedTableLocation,
format.addExtension("file-21"), file2FirstSnapshotRecords);
+
+ this.file3FirstSnapshotRecords = Lists.newArrayList(
+ record.copy(ImmutableMap.of("id", 24L, "data", "cloud")),
+ record.copy(ImmutableMap.of("id", 25L, "data", "zen")),
+ record.copy(ImmutableMap.of("id", 26L, "data", "sky"))
+ );
+ InputFile file31 = writeFile(sharedTableLocation,
format.addExtension("file-31"), file3FirstSnapshotRecords);
+
+ this.file1SecondSnapshotRecords = Lists.newArrayList(
record.copy(ImmutableMap.of("id", 0L, "data", "clarification")),
record.copy(ImmutableMap.of("id", 1L, "data", "risky")),
record.copy(ImmutableMap.of("id", 2L, "data", "falafel"))
);
- InputFile file1 = writeFile(sharedTableLocation,
format.addExtension("file-1"), file1Records);
+ InputFile file12 = writeFile(sharedTableLocation,
format.addExtension("file-12"), file1SecondSnapshotRecords);
Record nullData = record.copy();
nullData.setField("id", 11L);
nullData.setField("data", null);
- this.file2Records = Lists.newArrayList(
+ this.file2SecondSnapshotRecords = Lists.newArrayList(
record.copy(ImmutableMap.of("id", 10L, "data", "clammy")),
record.copy(ImmutableMap.of("id", 11L, "data", "evacuate")),
record.copy(ImmutableMap.of("id", 12L, "data", "tissue"))
);
- InputFile file2 = writeFile(sharedTableLocation,
format.addExtension("file-2"), file2Records);
+ InputFile file22 = writeFile(sharedTableLocation,
format.addExtension("file-22"), file2SecondSnapshotRecords);
- this.file3Records = Lists.newArrayList(
+ this.file3SecondSnapshotRecords = Lists.newArrayList(
record.copy(ImmutableMap.of("id", 20L, "data", "ocean")),
record.copy(ImmutableMap.of("id", 21L, "data", "holistic")),
record.copy(ImmutableMap.of("id", 22L, "data", "preventative"))
);
- InputFile file3 = writeFile(sharedTableLocation,
format.addExtension("file-3"), file3Records);
+ InputFile file32 = writeFile(sharedTableLocation,
format.addExtension("file-32"), file3SecondSnapshotRecords);
// commit the test data
sharedTable.newAppend()
.appendFile(DataFiles.builder(PartitionSpec.unpartitioned())
- .withInputFile(file1)
+ .withInputFile(file11)
+ .withMetrics(new Metrics(3L,
Review comment:
Instead of hard-coding the metrics for each data file, I think that this PR
should update `writeFile` to return a `DataFile` instance. That method can call
`appender.metrics()` to get the metrics when creating the `DataFile`, which
would ensure they are always correct. It would also make this setup method much
shorter.
----------------------------------------------------------------
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]