paleolimbot commented on code in PR #569:
URL: https://github.com/apache/arrow-nanoarrow/pull/569#discussion_r1693711040
##########
src/nanoarrow/nanoarrow_testing.hpp:
##########
@@ -2916,6 +2916,140 @@ class TestingJSONComparison {
/// @}
+namespace dsl {
Review Comment:
Maybe `factory`?
##########
src/nanoarrow/testing/testing_test.cc:
##########
@@ -1908,3 +1908,19 @@ TEST(NanoarrowTestingTest,
NanoarrowTestingTestArrayStreamComparison) {
)");
}
+
+TEST(SchemaDsl, Basic) {
+ using namespace nanoarrow::testing::dsl;
+
+ schema{children{
+ {"i", "int32 field name",
+ metadata{
+ "some_key=some_value",
+ }},
+ {"i", dictionary{"u"}, "dictionary field name",
+ metadata{
+ "some_key=some_value",
+ },
+ ARROW_FLAG_NULLABLE},
+ }};
Review Comment:
In tests I think I would still prefer to see the C calls (but perhaps this
is not where you were headed with this)
##########
src/nanoarrow/nanoarrow_testing.hpp:
##########
@@ -2916,6 +2916,140 @@ class TestingJSONComparison {
/// @}
+namespace dsl {
+/// \defgroup nanoarrow_testing-schema Schema factory DSL
+///
+/// @{
+
+/// \brief An alias to express a sequence of key value pairs.
+///
+/// Each pair is a string formatted like "key=value".
+using metadata = std::vector<std::string>;
Review Comment:
Would `std::vector<std::pair<std::string, std::string>>` work? I'm not sure
the world is clamouring to create metadata keys that contain the `=` symbol but
it seems like it would be nice to avoid string parsing if we can.
--
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]