@@ -1162,7 +1162,17 @@ INSTANTIATE_TEST_SUITE_P(
11621162 .json_str =
11631163 R"( {"metadata":{"format-version":2,"table-uuid":"test-uuid-1234","location":"s3://bucket/test","last-sequence-number":0,"last-updated-ms":0,"last-column-id":1,"schemas":[{"type":"struct","schema-id":1,"fields":[{"id":1,"name":"id","type":"int","required":true}]}],"current-schema-id":1,"partition-specs":[{"spec-id":0,"fields":[]}],"default-spec-id":0,"last-partition-id":0,"sort-orders":[{"order-id":0,"fields":[]}],"default-sort-order-id":0,"properties":{}},"config":{"warehouse":"s3://bucket/warehouse"}})" ,
11641164 .expected_model = {.metadata = MakeSimpleTableMetadata (),
1165- .config = {{" warehouse" , " s3://bucket/warehouse" }}}}),
1165+ .config = {{" warehouse" , " s3://bucket/warehouse" }}}},
1166+ // Unusable inline metadata (e.g. AWS Glue returns metadata that is not
1167+ // an object, or omits required fields). Because a metadata-location is
1168+ // present, parsing succeeds with null metadata so the catalog can load
1169+ // the complete metadata file from storage.
1170+ LoadTableResultDeserializeParam{
1171+ .test_name = " UnusableInlineMetadata" ,
1172+ .json_str =
1173+ R"( {"metadata-location":"s3://bucket/metadata/v1.json","metadata":"invalid"})" ,
1174+ .expected_model = {.metadata_location = " s3://bucket/metadata/v1.json" ,
1175+ .metadata = nullptr }}),
11661176 [](const ::testing::TestParamInfo<LoadTableResultDeserializeParam>& info) {
11671177 return info.param .test_name ;
11681178 });
@@ -1400,7 +1410,17 @@ INSTANTIATE_TEST_SUITE_P(
14001410 .json_str =
14011411 R"( {"metadata-location":"s3://bucket/metadata/v2.json","metadata":{"format-version":2,"table-uuid":"test-uuid-1234","location":"s3://bucket/test","last-sequence-number":0,"last-updated-ms":0,"last-column-id":1,"schemas":[{"type":"struct","schema-id":1,"fields":[{"id":1,"name":"id","type":"int","required":true}]}],"current-schema-id":1,"partition-specs":[{"spec-id":0,"fields":[]}],"default-spec-id":0,"last-partition-id":0,"sort-orders":[{"order-id":0,"fields":[]}],"default-sort-order-id":0,"properties":{}}})" ,
14021412 .expected_model = {.metadata_location = " s3://bucket/metadata/v2.json" ,
1403- .metadata = MakeSimpleTableMetadata ()}}),
1413+ .metadata = MakeSimpleTableMetadata ()}},
1414+ // Unusable inline metadata (e.g. AWS Glue returns metadata that is not
1415+ // an object, or omits required fields). Because a metadata-location is
1416+ // present, parsing succeeds with null metadata so the catalog can load
1417+ // the complete metadata file from storage.
1418+ CommitTableResponseDeserializeParam{
1419+ .test_name = " UnusableInlineMetadata" ,
1420+ .json_str =
1421+ R"( {"metadata-location":"s3://bucket/metadata/v2.json","metadata":"invalid"})" ,
1422+ .expected_model = {.metadata_location = " s3://bucket/metadata/v2.json" ,
1423+ .metadata = nullptr }}),
14041424 [](const ::testing::TestParamInfo<CommitTableResponseDeserializeParam>& info) {
14051425 return info.param .test_name ;
14061426 });
@@ -1433,12 +1453,6 @@ INSTANTIATE_TEST_SUITE_P(
14331453 .invalid_json_str =
14341454 R"( {"metadata-location":123,"metadata":{"format-version":2,"table-uuid":"test","location":"s3://test","last-sequence-number":0,"last-column-id":1,"last-updated-ms":0,"schemas":[{"type":"struct","schema-id":1,"fields":[{"id":1,"name":"id","type":"int","required":true}]}],"current-schema-id":1,"partition-specs":[{"spec-id":0,"fields":[]}],"default-spec-id":0,"last-partition-id":0,"sort-orders":[{"order-id":0,"fields":[]}],"default-sort-order-id":0}})" ,
14351455 .expected_error_message = " type must be string, but is number" },
1436- // Wrong type for metadata field
1437- CommitTableResponseInvalidParam{
1438- .test_name = " WrongMetadataType" ,
1439- .invalid_json_str =
1440- R"( {"metadata-location":"s3://bucket/metadata/v2.json","metadata":"invalid"})" ,
1441- .expected_error_message = " Cannot parse metadata from a non-object" },
14421456 // Empty JSON object
14431457 CommitTableResponseInvalidParam{
14441458 .test_name = " EmptyJson" ,
0 commit comments