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

Function FlattenLogicalListRecursively

cpp/src/arrow/array/array_nested.cc:472–513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470}
471
472Result<std::shared_ptr<Array>> FlattenLogicalListRecursively(const Array& in_array,
473 MemoryPool* memory_pool) {
474 std::shared_ptr<Array> array = in_array.Slice(0, in_array.length());
475 for (auto kind = array->type_id(); is_list(kind) || is_list_view(kind);
476 kind = array->type_id()) {
477 switch (kind) {
478 case Type::LIST: {
479 ARROW_ASSIGN_OR_RAISE(
480 array, (checked_cast<const ListArray*>(array.get())->Flatten(memory_pool)));
481 break;
482 }
483 case Type::LARGE_LIST: {
484 ARROW_ASSIGN_OR_RAISE(
485 array,
486 (checked_cast<const LargeListArray*>(array.get())->Flatten(memory_pool)));
487 break;
488 }
489 case Type::LIST_VIEW: {
490 ARROW_ASSIGN_OR_RAISE(
491 array,
492 (checked_cast<const ListViewArray*>(array.get())->Flatten(memory_pool)));
493 break;
494 }
495 case Type::LARGE_LIST_VIEW: {
496 ARROW_ASSIGN_OR_RAISE(
497 array,
498 (checked_cast<const LargeListViewArray*>(array.get())->Flatten(memory_pool)));
499 break;
500 }
501 case Type::FIXED_SIZE_LIST: {
502 ARROW_ASSIGN_OR_RAISE(
503 array,
504 (checked_cast<const FixedSizeListArray*>(array.get())->Flatten(memory_pool)));
505 break;
506 }
507 default:
508 Unreachable("unexpected non-list type");
509 break;
510 }
511 }
512 return array;
513}
514
515} // namespace internal
516

Callers 2

FlattenRecursivelyMethod · 0.85
FlattenRecursivelyFunction · 0.85

Calls 9

UnreachableFunction · 0.85
is_listFunction · 0.50
is_list_viewFunction · 0.50
ARROW_ASSIGN_OR_RAISEFunction · 0.50
SliceMethod · 0.45
lengthMethod · 0.45
type_idMethod · 0.45
FlattenMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected