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

Function DictArrayFromJSONString

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

Source from the content-addressed store, hash-verified

1084}
1085
1086Result<std::shared_ptr<Array>> DictArrayFromJSONString(
1087 const std::shared_ptr<DataType>& type, std::string_view indices_json,
1088 std::string_view dictionary_json) {
1089 if (type->id() != Type::DICTIONARY) {
1090 return Status::TypeError("DictArrayFromJSON requires dictionary type, got ", *type);
1091 }
1092
1093 const auto& dictionary_type = checked_cast<const DictionaryType&>(*type);
1094
1095 ARROW_ASSIGN_OR_RAISE(auto indices,
1096 ArrayFromJSONString(dictionary_type.index_type(), indices_json));
1097 ARROW_ASSIGN_OR_RAISE(auto dictionary, ArrayFromJSONString(dictionary_type.value_type(),
1098 dictionary_json));
1099 return DictionaryArray::FromArrays(type, std::move(indices), std::move(dictionary));
1100}
1101
1102Result<std::shared_ptr<Scalar>> ScalarFromJSONString(
1103 const std::shared_ptr<DataType>& type, std::string_view json_string) {

Callers 1

RunExampleFunction · 0.85

Calls 3

FromArraysFunction · 0.85
TypeErrorFunction · 0.50
idMethod · 0.45

Tested by

no test coverage detected