paleolimbot commented on code in PR #325:
URL: https://github.com/apache/arrow-nanoarrow/pull/325#discussion_r1409299772
##########
src/nanoarrow/nanoarrow_testing.hpp:
##########
@@ -1053,6 +1081,390 @@ class TestingJSONReader {
return NANOARROW_OK;
}
+ ArrowErrorCode SetArrayColumn(const json& value, ArrowArrayView* array_view,
+ ArrowArray* array, ArrowError* error,
+ const std::string& parent_error_prefix = "") {
+ NANOARROW_RETURN_NOT_OK(
+ Check(value.is_object(), error, "Expected Column to be a JSON
object"));
+
+ // Check + resolve name early to generate better error messages
+ NANOARROW_RETURN_NOT_OK(
+ Check(value.contains("name"), error, "Column missing key 'name'"));
+
+ const auto& name = value["name"];
+ NANOARROW_RETURN_NOT_OK(Check(name.is_null() || name.is_string(), error,
+ "Column name must be string or null"));
Review Comment:
I think `name` MAY be null (at least in the C data spec:
https://arrow.apache.org/docs/format/CDataInterface.html#c.ArrowSchema.name ),
so the writer serializes `name == NULL` as a JSON null (rather than omitting or
setting to `""`.
--
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]