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

Function DictScalarFromJSONString

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

Source from the content-addressed store, hash-verified

1138}
1139
1140Result<std::shared_ptr<Scalar>> DictScalarFromJSONString(
1141 const std::shared_ptr<DataType>& type, std::string_view index_json,
1142 std::string_view dictionary_json) {
1143 if (type->id() != Type::DICTIONARY) {
1144 return Status::TypeError("DictScalarFromJSONString requires dictionary type, got ",
1145 *type);
1146 }
1147
1148 const auto& dictionary_type = checked_cast<const DictionaryType&>(*type);
1149
1150 std::shared_ptr<Array> dictionary;
1151 ARROW_ASSIGN_OR_RAISE(auto index,
1152 ScalarFromJSONString(dictionary_type.index_type(), index_json));
1153 ARROW_ASSIGN_OR_RAISE(
1154 dictionary, ArrayFromJSONString(dictionary_type.value_type(), dictionary_json));
1155
1156 return DictionaryScalar::Make(std::move(index), std::move(dictionary));
1157}
1158
1159} // namespace json
1160} // 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