| 1084 | } |
| 1085 | |
| 1086 | Result<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 | |
| 1102 | Result<std::shared_ptr<Scalar>> ScalarFromJSONString( |
| 1103 | const std::shared_ptr<DataType>& type, std::string_view json_string) { |
no test coverage detected