MCPcopy Create free account
hub / github.com/apache/arrow / TestArrayRoundTrip

Function TestArrayRoundTrip

cpp/src/arrow/integration/json_integration_test.cc:748–773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

746}
747
748void TestArrayRoundTrip(const Array& array) {
749 static std::string name = "dummy";
750
751 rj::StringBuffer sb;
752 rj::Writer<rj::StringBuffer> writer(sb);
753
754 ASSERT_OK(json::WriteArray(name, array, &writer));
755
756 std::string array_as_json = sb.GetString();
757
758 rj::Document d;
759 // Pass explicit size to avoid ASAN issues with
760 // SIMD loads in RapidJson.
761 d.Parse(array_as_json.data(), array_as_json.size());
762 if (d.HasParseError()) {
763 FAIL() << "JSON parsing failed";
764 }
765
766 ASSERT_OK_AND_ASSIGN(
767 auto result_array,
768 json::ReadArray(default_memory_pool(), d, ::arrow::field(name, array.type())));
769 ASSERT_OK(result_array->ValidateFull());
770
771 // std::cout << array_as_json << std::endl;
772 CompareArraysDetailed(0, *result_array, array);
773}
774
775template <typename T, typename ValueType>
776void CheckPrimitive(const std::shared_ptr<DataType>& type,

Callers 2

CheckPrimitiveFunction · 0.85
TESTFunction · 0.85

Calls 7

WriteArrayFunction · 0.85
CompareArraysDetailedFunction · 0.85
GetStringMethod · 0.45
ParseMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
ValidateFullMethod · 0.45

Tested by

no test coverage detected