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

Method FromArrays

cpp/src/arrow/array/array_dict.cc:118–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118Result<std::shared_ptr<Array>> DictionaryArray::FromArrays(
119 const std::shared_ptr<DataType>& type, const std::shared_ptr<Array>& indices,
120 const std::shared_ptr<Array>& dictionary) {
121 if (type->id() != Type::DICTIONARY) {
122 return Status::TypeError("Expected a dictionary type");
123 }
124 const auto& dict = checked_cast<const DictionaryType&>(*type);
125 if (indices->type_id() != dict.index_type()->id()) {
126 return Status::TypeError(
127 "Dictionary type's index type does not match "
128 "indices array's type");
129 }
130 RETURN_NOT_OK(internal::CheckIndexBounds(*indices->data(),
131 static_cast<uint64_t>(dictionary->length())));
132 return std::make_shared<DictionaryArray>(type, indices, dictionary);
133}
134
135bool DictionaryArray::CanCompareIndices(const DictionaryArray& other) const {
136 DCHECK(dictionary()->type()->Equals(other.dictionary()->type()))

Callers

nothing calls this directly

Calls 7

CheckIndexBoundsFunction · 0.85
index_typeMethod · 0.80
TypeErrorFunction · 0.50
idMethod · 0.45
type_idMethod · 0.45
dataMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected