| 482 | } // namespace |
| 483 | |
| 484 | std::vector<std::shared_ptr<CastFunction>> GetNestedCasts() { |
| 485 | // We use the list<T> from the CastOptions when resolving the output type |
| 486 | |
| 487 | auto cast_list = std::make_shared<CastFunction>("cast_list", Type::LIST); |
| 488 | AddCommonCasts(Type::LIST, kOutputTargetType, cast_list.get()); |
| 489 | AddListCast<ListType, ListType>(cast_list.get()); |
| 490 | AddListCast<ListViewType, ListType>(cast_list.get()); |
| 491 | AddListCast<LargeListType, ListType>(cast_list.get()); |
| 492 | AddListCast<LargeListViewType, ListType>(cast_list.get()); |
| 493 | AddTypeToTypeCast<CastFixedToVarList<ListType>, FixedSizeListType>(cast_list.get()); |
| 494 | |
| 495 | auto cast_large_list = |
| 496 | std::make_shared<CastFunction>("cast_large_list", Type::LARGE_LIST); |
| 497 | AddCommonCasts(Type::LARGE_LIST, kOutputTargetType, cast_large_list.get()); |
| 498 | AddListCast<ListType, LargeListType>(cast_large_list.get()); |
| 499 | AddListCast<ListViewType, LargeListType>(cast_large_list.get()); |
| 500 | AddListCast<LargeListType, LargeListType>(cast_large_list.get()); |
| 501 | AddListCast<LargeListViewType, LargeListType>(cast_large_list.get()); |
| 502 | AddTypeToTypeCast<CastFixedToVarList<LargeListType>, FixedSizeListType>( |
| 503 | cast_large_list.get()); |
| 504 | |
| 505 | auto cast_map = std::make_shared<CastFunction>("cast_map", Type::MAP); |
| 506 | AddCommonCasts(Type::MAP, kOutputTargetType, cast_map.get()); |
| 507 | AddMapCast<MapType>(cast_map.get()); |
| 508 | AddMapCast<ListType>(cast_list.get()); |
| 509 | AddMapCast<LargeListType>(cast_large_list.get()); |
| 510 | |
| 511 | // FSL is a bit incomplete at the moment |
| 512 | auto cast_fsl = |
| 513 | std::make_shared<CastFunction>("cast_fixed_size_list", Type::FIXED_SIZE_LIST); |
| 514 | AddCommonCasts(Type::FIXED_SIZE_LIST, kOutputTargetType, cast_fsl.get()); |
| 515 | AddTypeToTypeCast<CastFixedList, FixedSizeListType>(cast_fsl.get()); |
| 516 | AddTypeToTypeCast<CastVarToFixedList<ListType>, ListType>(cast_fsl.get()); |
| 517 | AddTypeToTypeCast<CastVarToFixedList<ListViewType>, ListViewType>(cast_fsl.get()); |
| 518 | AddTypeToTypeCast<CastVarToFixedList<LargeListType>, LargeListType>(cast_fsl.get()); |
| 519 | AddTypeToTypeCast<CastVarToFixedList<LargeListViewType>, LargeListViewType>( |
| 520 | cast_fsl.get()); |
| 521 | AddTypeToTypeCast<CastVarToFixedList<ListType>, MapType>(cast_fsl.get()); |
| 522 | |
| 523 | // So is struct |
| 524 | auto cast_struct = std::make_shared<CastFunction>("cast_struct", Type::STRUCT); |
| 525 | AddCommonCasts(Type::STRUCT, kOutputTargetType, cast_struct.get()); |
| 526 | AddTypeToTypeCast<CastStruct, StructType>(cast_struct.get()); |
| 527 | |
| 528 | // So is dictionary |
| 529 | auto cast_dictionary = |
| 530 | std::make_shared<CastFunction>("cast_dictionary", Type::DICTIONARY); |
| 531 | AddCommonCasts(Type::DICTIONARY, kOutputTargetType, cast_dictionary.get()); |
| 532 | |
| 533 | return {cast_list, cast_large_list, cast_map, cast_fsl, cast_struct, cast_dictionary}; |
| 534 | } |
| 535 | |
| 536 | } // namespace compute::internal |
| 537 | } // namespace arrow |
no test coverage detected