| 726 | )example"; |
| 727 | |
| 728 | void TestSchemaRoundTrip(const std::shared_ptr<Schema>& schema) { |
| 729 | arrow::internal::JsonWriter writer; |
| 730 | |
| 731 | DictionaryFieldMapper mapper(*schema); |
| 732 | |
| 733 | writer.StartObject(); |
| 734 | ASSERT_OK(json::WriteSchema(*schema, mapper, &writer)); |
| 735 | writer.EndObject(); |
| 736 | |
| 737 | ASSERT_OK_AND_ASSIGN(std::string_view json_schema, writer.GetString()); |
| 738 | |
| 739 | simdjson::dom::parser parser; |
| 740 | ASSERT_OK_AND_ASSIGN(auto d, internal::ResolveSimdjsonResult( |
| 741 | parser.parse(json_schema.data(), json_schema.size()), |
| 742 | "Failed to parse JSON")); |
| 743 | |
| 744 | DictionaryMemo in_memo; |
| 745 | ASSERT_OK_AND_ASSIGN(auto result_schema, |
| 746 | json::ReadSchema(d, default_memory_pool(), &in_memo)); |
| 747 | AssertSchemaEqual(schema, result_schema, /*check_metadata=*/true); |
| 748 | } |
| 749 | |
| 750 | void TestArrayRoundTrip(const Array& array) { |
| 751 | static std::string name = "dummy"; |
no test coverage detected