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

Method GetResult

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

Source from the content-addressed store, hash-verified

380 Status Unify(const Array& dictionary) override { return Unify(dictionary, nullptr); }
381
382 Status GetResult(std::shared_ptr<DataType>* out_type,
383 std::shared_ptr<Array>* out_dict) override {
384 int64_t dict_length = memo_table_.size();
385 std::shared_ptr<DataType> index_type;
386 if (dict_length <= std::numeric_limits<int8_t>::max()) {
387 index_type = int8();
388 } else if (dict_length <= std::numeric_limits<int16_t>::max()) {
389 index_type = int16();
390 } else if (dict_length <= std::numeric_limits<int32_t>::max()) {
391 index_type = int32();
392 } else {
393 index_type = int64();
394 }
395 // Build unified dictionary type with the right index type
396 *out_type = arrow::dictionary(index_type, value_type_);
397
398 // Build unified dictionary array
399 ARROW_ASSIGN_OR_RAISE(
400 auto data, DictTraits::GetDictionaryArrayData(pool_, value_type_, memo_table_,
401 0 /* start_offset */));
402 *out_dict = MakeArray(data);
403 return Status::OK();
404 }
405
406 Status GetResultWithIndexType(const std::shared_ptr<DataType>& index_type,
407 std::shared_ptr<Array>* out_dict) override {

Callers 1

TESTFunction · 0.45

Calls 4

MakeArrayFunction · 0.70
dictionaryFunction · 0.50
OKFunction · 0.50
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.36