@@ -838,7 +838,7 @@ nlohmann::json ToJson(const TableMetadata& table_metadata) {
838838 json[kFormatVersion ] = table_metadata.format_version ;
839839 json[kTableUuid ] = table_metadata.table_uuid ;
840840 json[kLocation ] = table_metadata.location ;
841- if (table_metadata.format_version > kFormatVersion1 ) {
841+ if (table_metadata.format_version > 1 ) {
842842 json[kLastSequenceNumber ] = table_metadata.last_sequence_number ;
843843 }
844844 json[kLastUpdatedMs ] = UnixMsFromTimePointMs (table_metadata.last_updated_ms );
@@ -847,7 +847,7 @@ nlohmann::json ToJson(const TableMetadata& table_metadata) {
847847 // for older readers, continue writing the current schema as "schema".
848848 // this is only needed for v1 because support for schemas and current-schema-id
849849 // is required in v2 and later.
850- if (table_metadata.format_version == kFormatVersion1 ) {
850+ if (table_metadata.format_version == 1 ) {
851851 for (const auto & schema : table_metadata.schemas ) {
852852 if (schema->schema_id () == table_metadata.current_schema_id ) {
853853 json[kSchema ] = ToJson (*schema);
@@ -861,7 +861,7 @@ nlohmann::json ToJson(const TableMetadata& table_metadata) {
861861 json[kSchemas ] = ToJsonList (table_metadata.schemas );
862862
863863 // for older readers, continue writing the default spec as "partition-spec"
864- if (table_metadata.format_version == kFormatVersion1 ) {
864+ if (table_metadata.format_version == 1 ) {
865865 for (const auto & partition_spec : table_metadata.partition_specs ) {
866866 if (partition_spec->spec_id () == table_metadata.default_spec_id ) {
867867 json[kPartitionSpec ] = ToJson (*partition_spec);
@@ -890,7 +890,7 @@ nlohmann::json ToJson(const TableMetadata& table_metadata) {
890890 json[kCurrentSnapshotId ] = nlohmann::json::value_t ::null;
891891 }
892892
893- if (table_metadata.format_version >= kFormatVersion3 ) {
893+ if (table_metadata.format_version >= 3 ) {
894894 json[kNextRowId ] = table_metadata.next_row_id ;
895895 }
896896
@@ -945,7 +945,7 @@ Result<std::shared_ptr<Schema>> ParseSchemas(
945945 current_schema_id, SafeDumpJson (schema_array));
946946 }
947947 } else {
948- if (format_version != kFormatVersion1 ) {
948+ if (format_version != 1 ) {
949949 return JsonParseError (" {} must exist in format v{}" , kSchemas , format_version);
950950 }
951951 ICEBERG_ASSIGN_OR_RAISE (auto schema_json,
@@ -983,7 +983,7 @@ Status ParsePartitionSpecs(const nlohmann::json& json, int8_t format_version,
983983 partition_specs.push_back (std::move (spec));
984984 }
985985 } else {
986- if (format_version != kFormatVersion1 ) {
986+ if (format_version != 1 ) {
987987 return JsonParseError (" {} must exist in format v{}" , kPartitionSpecs ,
988988 format_version);
989989 }
@@ -999,9 +999,8 @@ Status ParsePartitionSpecs(const nlohmann::json& json, int8_t format_version,
999999 std::vector<PartitionField> fields;
10001000 for (const auto & entry_json : partition_spec_json) {
10011001 ICEBERG_ASSIGN_OR_RAISE (
1002- auto field,
1003- PartitionFieldFromJson (
1004- entry_json, /* allow_field_id_missing=*/ format_version == kFormatVersion1 ));
1002+ auto field, PartitionFieldFromJson (
1003+ entry_json, /* allow_field_id_missing=*/ format_version == 1 ));
10051004 int32_t field_id = field->field_id ();
10061005 if (field_id == SchemaField::kInvalidFieldId ) {
10071006 // If the field ID is not set, we need to assign a new one
@@ -1045,7 +1044,7 @@ Status ParseSortOrders(const nlohmann::json& json, int8_t format_version,
10451044 sort_orders.push_back (std::move (sort_order));
10461045 }
10471046 } else {
1048- if (format_version > kFormatVersion1 ) {
1047+ if (format_version > 1 ) {
10491048 return JsonParseError (" {} must exist in format v{}" , kSortOrders , format_version);
10501049 }
10511050 auto sort_order = SortOrder::Unsorted ();
@@ -1067,7 +1066,7 @@ Result<std::unique_ptr<TableMetadata>> TableMetadataFromJson(const nlohmann::jso
10671066
10681067 ICEBERG_ASSIGN_OR_RAISE (table_metadata->format_version ,
10691068 GetJsonValue<int8_t >(json, kFormatVersion ));
1070- if (table_metadata->format_version < kFormatVersion1 ||
1069+ if (table_metadata->format_version < 1 ||
10711070 table_metadata->format_version > TableMetadata::kSupportedTableFormatVersion ) {
10721071 return JsonParseError (" Cannot read unsupported version: {}" ,
10731072 table_metadata->format_version );
@@ -1078,7 +1077,7 @@ Result<std::unique_ptr<TableMetadata>> TableMetadataFromJson(const nlohmann::jso
10781077 ICEBERG_ASSIGN_OR_RAISE (table_metadata->location ,
10791078 GetJsonValue<std::string>(json, kLocation ));
10801079
1081- if (table_metadata->format_version > kFormatVersion1 ) {
1080+ if (table_metadata->format_version > 1 ) {
10821081 ICEBERG_ASSIGN_OR_RAISE (table_metadata->last_sequence_number ,
10831082 GetJsonValue<int64_t >(json, kLastSequenceNumber ));
10841083 } else {
@@ -1100,7 +1099,7 @@ Result<std::unique_ptr<TableMetadata>> TableMetadataFromJson(const nlohmann::jso
11001099 ICEBERG_ASSIGN_OR_RAISE (table_metadata->last_partition_id ,
11011100 GetJsonValue<int32_t >(json, kLastPartitionId ));
11021101 } else {
1103- if (table_metadata->format_version > kFormatVersion1 ) {
1102+ if (table_metadata->format_version > 1 ) {
11041103 return JsonParseError (" {} must exist in format v{}" , kLastPartitionId ,
11051104 table_metadata->format_version );
11061105 }
@@ -1130,7 +1129,7 @@ Result<std::unique_ptr<TableMetadata>> TableMetadataFromJson(const nlohmann::jso
11301129 table_metadata->current_snapshot_id ,
11311130 GetJsonValueOrDefault<int64_t >(json, kCurrentSnapshotId , kInvalidSnapshotId ));
11321131
1133- if (table_metadata->format_version >= kFormatVersion3 ) {
1132+ if (table_metadata->format_version >= 3 ) {
11341133 ICEBERG_ASSIGN_OR_RAISE (table_metadata->next_row_id ,
11351134 GetJsonValue<int64_t >(json, kNextRowId ));
11361135 } else {
0 commit comments