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

Function ArrayFromJSONString

cpp/src/arrow/json/from_string.cc:978–995  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

976} // namespace
977
978Result<std::shared_ptr<Array>> ArrayFromJSONString(const std::shared_ptr<DataType>& type,
979 std::string_view json_string) {
980 std::shared_ptr<JSONConverter> converter;
981 RETURN_NOT_OK(GetConverter(type, &converter));
982
983 rj::Document json_doc;
984 json_doc.Parse<kParseFlags>(json_string.data(), json_string.length());
985 if (json_doc.HasParseError()) {
986 return Status::Invalid("JSON parse error at offset ", json_doc.GetErrorOffset(), ": ",
987 GetParseError_En(json_doc.GetParseError()));
988 }
989
990 // The JSON document should be an array, append it
991 RETURN_NOT_OK(converter->AppendValues(json_doc));
992 std::shared_ptr<Array> out;
993 RETURN_NOT_OK(converter->Finish(&out));
994 return out;
995}
996
997Result<std::shared_ptr<Array>> ArrayFromJSONString(const std::shared_ptr<DataType>& type,
998 const std::string& json_string) {

Callers 14

SliceArrayFromJSONFunction · 0.85
TestSessionFunction · 0.85
DictScalarFromJSONStringFunction · 0.85
TYPED_TEST_PFunction · 0.85
TESTFunction · 0.85
TestDecimalBasicFunction · 0.85
TestIntegerListMethod · 0.85
TestIntegerListErrorsMethod · 0.85
TestNullListMethod · 0.85
TestIntegerListListMethod · 0.85

Calls 6

GetConverterFunction · 0.70
InvalidFunction · 0.50
dataMethod · 0.45
lengthMethod · 0.45
AppendValuesMethod · 0.45
FinishMethod · 0.45

Tested by 8

TestSessionFunction · 0.68
TYPED_TEST_PFunction · 0.68
TESTFunction · 0.68
TestDecimalBasicFunction · 0.68
TestIntegerListMethod · 0.68
TestIntegerListErrorsMethod · 0.68
TestNullListMethod · 0.68
TestIntegerListListMethod · 0.68