@@ -103,14 +103,13 @@ TEST(JsonInternalTest, SortField) {
103103
104104TEST (JsonInternalTest, SortOrder) {
105105 auto schema = std::make_shared<Schema>(
106- std::vector<SchemaField>{SchemaField (5 , " region" , iceberg:: string (), false ),
107- SchemaField (7 , " ts" , iceberg:: int64 (), false )},
106+ std::vector<SchemaField>{SchemaField (5 , " region" , string (), false ),
107+ SchemaField (7 , " ts" , int64 (), false )},
108108 /* schema_id=*/ 100 );
109109 auto identity_transform = Transform::Identity ();
110110 SortField st_ts (5 , identity_transform, SortDirection::kAscending , NullOrder::kFirst );
111111 SortField st_bar (7 , identity_transform, SortDirection::kDescending , NullOrder::kLast );
112- ICEBERG_UNWRAP_OR_FAIL (auto sort_order, SortOrder::Make (100 , {st_ts, st_bar}));
113- EXPECT_TRUE (sort_order->Validate (*schema));
112+ ICEBERG_UNWRAP_OR_FAIL (auto sort_order, SortOrder::Make (*schema, 100 , {st_ts, st_bar}));
114113 nlohmann::json expected_sort_order =
115114 R"( {"order-id":100,"fields":[
116115 {"transform":"identity","source-id":5,"direction":"asc","null-order":"nulls-first"},
@@ -132,7 +131,7 @@ TEST(JsonInternalTest, PartitionField) {
132131 TestJsonConversion (field, expected_json);
133132}
134133
135- TEST (JsonPartitionTest , PartitionFieldFromJsonMissingField) {
134+ TEST (JsonInternalTest , PartitionFieldFromJsonMissingField) {
136135 nlohmann::json invalid_json =
137136 R"( {"field-id":101,"transform":"identity","name":"region"})" _json;
138137 // missing source-id
@@ -143,15 +142,19 @@ TEST(JsonPartitionTest, PartitionFieldFromJsonMissingField) {
143142 EXPECT_THAT (result, HasErrorMessage (" Missing 'source-id'" ));
144143}
145144
146- TEST (JsonPartitionTest , PartitionSpec) {
145+ TEST (JsonInternalTest , PartitionSpec) {
147146 auto schema = std::make_shared<Schema>(
148147 std::vector<SchemaField>{SchemaField (3 , " region" , string (), false ),
149148 SchemaField (5 , " ts" , int64 (), false )},
150149 /* schema_id=*/ 100 );
151150 auto identity_transform = Transform::Identity ();
152- PartitionSpec spec (1 , {PartitionField (3 , 101 , " region" , identity_transform),
153- PartitionField (5 , 102 , " ts" , identity_transform)});
154- auto json = ToJson (spec);
151+ ICEBERG_UNWRAP_OR_FAIL (
152+ auto spec,
153+ PartitionSpec::Make (*schema, 1 ,
154+ {PartitionField (3 , 101 , " region" , identity_transform),
155+ PartitionField (5 , 102 , " ts" , identity_transform)},
156+ false ));
157+ auto json = ToJson (*spec);
155158 nlohmann::json expected_json = R"( {"spec-id": 1,
156159 "fields": [
157160 {"source-id": 3,
@@ -165,9 +168,9 @@ TEST(JsonPartitionTest, PartitionSpec) {
165168
166169 EXPECT_EQ (json, expected_json);
167170
168- auto parsed_spec_result = PartitionSpecFromJson (schema, json);
171+ auto parsed_spec_result = PartitionSpecFromJson (schema, json, 1 );
169172 ASSERT_TRUE (parsed_spec_result.has_value ()) << parsed_spec_result.error ().message ;
170- EXPECT_EQ (spec, *parsed_spec_result.value ());
173+ EXPECT_EQ (* spec, *parsed_spec_result.value ());
171174}
172175
173176TEST (JsonInternalTest, SnapshotRefBranch) {
0 commit comments