Merge list types based on options. Returns nullptr for non-list types.
| 685 | |
| 686 | // Merge list types based on options. Returns nullptr for non-list types. |
| 687 | Result<std::shared_ptr<DataType>> MergeStructs( |
| 688 | const std::shared_ptr<DataType>& promoted_type, |
| 689 | const std::shared_ptr<DataType>& other_type, const Field::MergeOptions& options) { |
| 690 | SchemaBuilder builder(SchemaBuilder::CONFLICT_APPEND, options); |
| 691 | // Add the LHS fields. Duplicates will be preserved. |
| 692 | RETURN_NOT_OK(builder.AddFields(promoted_type->fields())); |
| 693 | |
| 694 | // Add the RHS fields. Duplicates will be merged, unless the field was |
| 695 | // already a duplicate, in which case we error (since we don't know which |
| 696 | // field to merge with). |
| 697 | builder.SetPolicy(SchemaBuilder::CONFLICT_MERGE); |
| 698 | RETURN_NOT_OK(builder.AddFields(other_type->fields())); |
| 699 | |
| 700 | ARROW_ASSIGN_OR_RAISE(auto schema, builder.Finish()); |
| 701 | return struct_(schema->fields()); |
| 702 | } |
| 703 | |
| 704 | // Merge list types based on options. Returns nullptr for non-list types. |
| 705 | Result<std::shared_ptr<DataType>> MaybeMergeListTypes( |
no test coverage detected