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

Method FromArrays

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

Source from the content-addressed store, hash-verified

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