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

Function FlattenLogicalListRecursively

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

Source from the content-addressed store, hash-verified

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

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