Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ private static MetadataUpdate readSetStatistics(JsonNode node) {
}

private static MetadataUpdate readRemoveStatistics(JsonNode node) {
int snapshotId = JsonUtil.getInt(SNAPSHOT_ID, node);
long snapshotId = JsonUtil.getLong(SNAPSHOT_ID, node);
return new MetadataUpdate.RemoveStatistics(snapshotId);
}

Expand Down
22 changes: 12 additions & 10 deletions core/src/test/java/org/apache/iceberg/TestMetadataUpdateParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -773,24 +773,26 @@ public void testSetLocationToJson() {
@Test
public void testSetStatistics() {
String json =
"{\"action\":\"set-statistics\",\"snapshot-id\":42,\"statistics\":{\"snapshot-id\":42,"
"{\"action\":\"set-statistics\",\"snapshot-id\":1940541653261589030,\"statistics\":{\"snapshot-id\":1940541653261589030,"
+ "\"statistics-path\":\"s3://bucket/warehouse/stats.puffin\",\"file-size-in-bytes\":124,"
+ "\"file-footer-size-in-bytes\":27,\"blob-metadata\":[{\"type\":\"boring-type\","
+ "\"snapshot-id\":42,\"sequence-number\":2,\"fields\":[1],"
+ "\"snapshot-id\":1940541653261589030,\"sequence-number\":2,\"fields\":[1],"
+ "\"properties\":{\"prop-key\":\"prop-value\"}}]}}";

long snapshotId = 1940541653261589030L;
MetadataUpdate expected =
new MetadataUpdate.SetStatistics(
42,
snapshotId,
new GenericStatisticsFile(
42,
snapshotId,
"s3://bucket/warehouse/stats.puffin",
124,
27,
124L,
27L,
ImmutableList.of(
new GenericBlobMetadata(
"boring-type",
42,
2,
snapshotId,
2L,
ImmutableList.of(1),
ImmutableMap.of("prop-key", "prop-value")))));
assertEquals(
Expand All @@ -803,8 +805,8 @@ public void testSetStatistics() {

@Test
public void testRemoveStatistics() {
String json = "{\"action\":\"remove-statistics\",\"snapshot-id\":42}";
MetadataUpdate expected = new MetadataUpdate.RemoveStatistics(42);
String json = "{\"action\":\"remove-statistics\",\"snapshot-id\":1940541653261589030}";
MetadataUpdate expected = new MetadataUpdate.RemoveStatistics(1940541653261589030L);
assertEquals(
MetadataUpdateParser.REMOVE_STATISTICS, expected, MetadataUpdateParser.fromJson(json));
Assert.assertEquals(
Expand Down