| 1016 | } |
| 1017 | |
| 1018 | Result<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 | |
| 1034 | Result<std::shared_ptr<Scalar>> ScalarFromJSONString( |
| 1035 | const std::shared_ptr<DataType>& type, std::string_view json_string) { |
no test coverage detected