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

Function DictArrayFromJSONString

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

Source from the content-addressed store, hash-verified

1016}
1017
1018Result<std::shared_ptr<Array>> DictArrayFromJSONString(
1019 const std::shared_ptr<DataType>& type, std::string_view indices_json,
1020 std::string_view dictionary_json) {
1021 if (type->id() != Type::DICTIONARY) {
1022 return Status::TypeError("DictArrayFromJSON requires dictionary type, got ", *type);
1023 }
1024
1025 const auto& dictionary_type = checked_cast<const DictionaryType&>(*type);
1026
1027 ARROW_ASSIGN_OR_RAISE(auto indices,
1028 ArrayFromJSONString(dictionary_type.index_type(), indices_json));
1029 ARROW_ASSIGN_OR_RAISE(auto dictionary, ArrayFromJSONString(dictionary_type.value_type(),
1030 dictionary_json));
1031 return DictionaryArray::FromArrays(type, std::move(indices), std::move(dictionary));
1032}
1033
1034Result<std::shared_ptr<Scalar>> ScalarFromJSONString(
1035 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