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

Function DictScalarFromJSONString

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

Source from the content-addressed store, hash-verified

1051}
1052
1053Result<std::shared_ptr<Scalar>> DictScalarFromJSONString(
1054 const std::shared_ptr<DataType>& type, std::string_view index_json,
1055 std::string_view dictionary_json) {
1056 if (type->id() != Type::DICTIONARY) {
1057 return Status::TypeError("DictScalarFromJSONString requires dictionary type, got ",
1058 *type);
1059 }
1060
1061 const auto& dictionary_type = checked_cast<const DictionaryType&>(*type);
1062
1063 std::shared_ptr<Array> dictionary;
1064 ARROW_ASSIGN_OR_RAISE(auto index,
1065 ScalarFromJSONString(dictionary_type.index_type(), index_json));
1066 ARROW_ASSIGN_OR_RAISE(
1067 dictionary, ArrayFromJSONString(dictionary_type.value_type(), dictionary_json));
1068
1069 return DictionaryScalar::Make(std::move(index), std::move(dictionary));
1070}
1071
1072} // namespace json
1073} // namespace arrow

Callers 1

Calls 6

ArrayFromJSONStringFunction · 0.85
TypeErrorFunction · 0.50
ARROW_ASSIGN_OR_RAISEFunction · 0.50
MakeFunction · 0.50
idMethod · 0.45
value_typeMethod · 0.45

Tested by

no test coverage detected