| 812 | } |
| 813 | |
| 814 | Status ListToSchemaField(const GroupNode& group, LevelInfo current_levels, |
| 815 | SchemaTreeContext* ctx, const SchemaField* parent, |
| 816 | SchemaField* out) { |
| 817 | if (group.field_count() != 1) { |
| 818 | return Status::Invalid("LIST-annotated groups must have a single child."); |
| 819 | } |
| 820 | |
| 821 | if (group.is_optional()) { |
| 822 | current_levels.IncrementOptional(); |
| 823 | } |
| 824 | |
| 825 | out->children.resize(group.field_count()); |
| 826 | SchemaField* child_field = &out->children[0]; |
| 827 | |
| 828 | ctx->LinkParent(out, parent); |
| 829 | ctx->LinkParent(child_field, out); |
| 830 | |
| 831 | int16_t repeated_ancestor_def_level = current_levels.IncrementRepeated(); |
| 832 | RETURN_NOT_OK(ResolveList(group, current_levels, ctx, out)); |
| 833 | |
| 834 | ARROW_ASSIGN_OR_RAISE(auto list_type, |
| 835 | MakeArrowList(child_field->field, ctx->properties)); |
| 836 | out->field = ::arrow::field(group.name(), std::move(list_type), group.is_optional(), |
| 837 | FieldIdMetadata(group.field_id())); |
| 838 | out->level_info = current_levels; |
| 839 | // At this point current levels contains the def level for this list, |
| 840 | // we need to reset to the prior parent. |
| 841 | out->level_info.repeated_ancestor_def_level = repeated_ancestor_def_level; |
| 842 | return Status::OK(); |
| 843 | } |
| 844 | |
| 845 | Status GroupToSchemaField(const GroupNode& node, LevelInfo current_levels, |
| 846 | SchemaTreeContext* ctx, const SchemaField* parent, |
no test coverage detected