rdblue commented on pull request #1101:
URL: https://github.com/apache/iceberg/pull/1101#issuecomment-664025221
@chenjunjiedada, the tests originally used `apply` to test the logic in the
merge append implementation. It wasn't necessary to actually commit because the
logic to add a snapshot was tested separately. But now, adding sequence number
assertions should actually perform commits and check the sequence numbers after
commit. Otherwise, this doesn't really test sequence numbers for all of the
cases because some cases never commit.
For example, `testEmptyTableAppend` should be updated like this:
```java
@Test
public void testEmptyTableAppend() {
Assert.assertEquals("Table should start empty", 0,
listManifestFiles().size());
TableMetadata base = readMetadata();
Assert.assertNull("Should not have a current snapshot",
base.currentSnapshot());
Assert.assertEquals("Last sequence number should start at 0", 0,
base.lastSequenceNumber());
table.newAppend()
.appendFile(FILE_A)
.appendFile(FILE_B)
.commit(); // <-- changed to commit
Snapshot committed = table.currentSnapshot();
Assert.assertNotNull("Should create a snapshot",
table.currentSnapshot());
V1Assert.assertEquals("Last sequence number should be 0", 0,
table.ops().current().lastSequenceNumber());
V2Assert.assertEquals("Last sequence number should be 1", 1,
table.ops().current().lastSequenceNumber());
Assert.assertEquals("Should create 1 manifest for initial write",
1, committed.allManifests().size());
long pendingId = committed.snapshotId();
validateManifest(committed.allManifests().get(0),
seqs(1, 1),
ids(pendingId, pendingId),
files(FILE_A, FILE_B),
statuses(Status.ADDED, Status.ADDED));
}
```
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]