in core/src/main/java/org/apache/iceberg/MetadataUpdateParser.java [295:359]
public static MetadataUpdate fromJson(JsonNode jsonNode) {
Preconditions.checkArgument(
jsonNode != null && jsonNode.isObject(),
"Cannot parse metadata update from non-object value: %s",
jsonNode);
Preconditions.checkArgument(
jsonNode.hasNonNull(ACTION), "Cannot parse metadata update. Missing field: action");
String action = JsonUtil.getString(ACTION, jsonNode).toLowerCase(Locale.ROOT);
switch (action) {
case ASSIGN_UUID:
return readAssignUUID(jsonNode);
case UPGRADE_FORMAT_VERSION:
return readUpgradeFormatVersion(jsonNode);
case ADD_SCHEMA:
return readAddSchema(jsonNode);
case SET_CURRENT_SCHEMA:
return readSetCurrentSchema(jsonNode);
case ADD_PARTITION_SPEC:
return readAddPartitionSpec(jsonNode);
case SET_DEFAULT_PARTITION_SPEC:
return readSetDefaultPartitionSpec(jsonNode);
case ADD_SORT_ORDER:
return readAddSortOrder(jsonNode);
case SET_DEFAULT_SORT_ORDER:
return readSetDefaultSortOrder(jsonNode);
case SET_STATISTICS:
return readSetStatistics(jsonNode);
case REMOVE_STATISTICS:
return readRemoveStatistics(jsonNode);
case SET_PARTITION_STATISTICS:
return readSetPartitionStatistics(jsonNode);
case REMOVE_PARTITION_STATISTICS:
return readRemovePartitionStatistics(jsonNode);
case ADD_SNAPSHOT:
return readAddSnapshot(jsonNode);
case REMOVE_SNAPSHOTS:
return readRemoveSnapshots(jsonNode);
case REMOVE_SNAPSHOT_REF:
return readRemoveSnapshotRef(jsonNode);
case SET_SNAPSHOT_REF:
return readSetSnapshotRef(jsonNode);
case SET_PROPERTIES:
return readSetProperties(jsonNode);
case REMOVE_PROPERTIES:
return readRemoveProperties(jsonNode);
case SET_LOCATION:
return readSetLocation(jsonNode);
case ADD_VIEW_VERSION:
return readAddViewVersion(jsonNode);
case SET_CURRENT_VIEW_VERSION:
return readCurrentViewVersionId(jsonNode);
case REMOVE_PARTITION_SPECS:
return readRemovePartitionSpecs(jsonNode);
case REMOVE_SCHEMAS:
return readRemoveSchemas(jsonNode);
case ADD_ENCRYPTION_KEY:
return readAddEncryptionKey(jsonNode);
case REMOVE_ENCRYPTION_KEY:
return readRemoveEncryptionKey(jsonNode);
default:
throw new UnsupportedOperationException(
String.format("Cannot convert metadata update action to json: %s", action));
}
}