Skip to content

Commit

Permalink
Core: Make TableMetadataParser.fromJson taking JsonNode public (a…
Browse files Browse the repository at this point in the history
…pache#7032)

In the WIP for the Nessie Iceberg REST catalog server, there are a few places that currently require us to first serialize a `TableMetadata` to a `String` just to parse it right back into a `TableMetadata`, but this time with the right metadata-location.

First occurence is when we write the table metadata, where we have to first store the table metadata, get the metadata location, and then return the table metadata with the metadata location (and updates cleared).
Second occurence is when we return a table metadata with "transient properties", which are used to pass the "expected Nessie commit" around.

This change makes the two `TableMetadataParser.fromJson()` taking a `JsonNode` public
  • Loading branch information
snazy authored Jun 29, 2023
1 parent db3fa83 commit 8a8508d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public static TableMetadata fromJson(String metadataLocation, String json) {
return JsonUtil.parse(json, node -> TableMetadataParser.fromJson(metadataLocation, node));
}

static TableMetadata fromJson(InputFile file, JsonNode node) {
public static TableMetadata fromJson(InputFile file, JsonNode node) {
return fromJson(file.location(), node);
}

Expand All @@ -308,7 +308,7 @@ public static TableMetadata fromJson(JsonNode node) {
}

@SuppressWarnings({"checkstyle:CyclomaticComplexity", "checkstyle:MethodLength"})
static TableMetadata fromJson(String metadataLocation, JsonNode node) {
public static TableMetadata fromJson(String metadataLocation, JsonNode node) {
Preconditions.checkArgument(
node.isObject(), "Cannot parse metadata from a non-object: %s", node);

Expand Down

0 comments on commit 8a8508d

Please sign in to comment.