LuciferYang opened a new pull request, #997: URL: https://github.com/apache/iceberg-cpp/pull/997
## What `ListTypeFromJson` in `src/iceberg/json_serde.cc` read the element type with the const `json[kElement]` accessor. For a list type object without an `"element"` key this is undefined behavior in nlohmann: with assertions enabled it aborts on `JSON_ASSERT`, and under `NDEBUG` it dereferences the end iterator. Table metadata with a list-typed field that lacks `"element"` reaches it through `SchemaFromJson`. Follow-up to #982 (https://github.com/apache/iceberg-cpp/pull/982#pullrequestreview-5477946927). Closes #996. ## How Read the key with `GetJsonValue<nlohmann::json>(json, kElement)` and pass the result to `TypeFromJson`, the same way `MapTypeFromJson` reads `key` and `value`. A missing key now returns `JsonParseError`. This was the only const `json[key]` read in `src/iceberg` that did not check the key exists first. ## Testing `JsonInternalTest.ListTypeFromJsonMissingElement` passes a list type without `"element"` to `TypeFromJson` and expects `kJsonParseError` with "Missing 'element'". Without the fix the test aborts with `Assertion failed: (it != m_data.m_value.object->end())` in `json.hpp`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
