| 840 | } |
| 841 | |
| 842 | Status GroupToSchemaField(const GroupNode& node, LevelInfo current_levels, |
| 843 | SchemaTreeContext* ctx, const SchemaField* parent, |
| 844 | SchemaField* out) { |
| 845 | if (node.logical_type()->is_list()) { |
| 846 | return ListToSchemaField(node, current_levels, ctx, parent, out); |
| 847 | } else if (node.logical_type()->is_map()) { |
| 848 | return MapToSchemaField(node, current_levels, ctx, parent, out); |
| 849 | } |
| 850 | std::shared_ptr<ArrowType> type; |
| 851 | if (node.is_repeated()) { |
| 852 | // Simple repeated struct |
| 853 | // |
| 854 | // repeated group $NAME { |
| 855 | // r/o TYPE[0] f0 |
| 856 | // r/o TYPE[1] f1 |
| 857 | // } |
| 858 | out->children.resize(1); |
| 859 | |
| 860 | int16_t repeated_ancestor_def_level = current_levels.IncrementRepeated(); |
| 861 | RETURN_NOT_OK(GroupToStruct(node, current_levels, ctx, out, &out->children[0])); |
| 862 | ARROW_ASSIGN_OR_RAISE(auto list_type, |
| 863 | MakeArrowList(out->children[0].field, ctx->properties)); |
| 864 | out->field = ::arrow::field(node.name(), std::move(list_type), |
| 865 | /*nullable=*/false, FieldIdMetadata(node.field_id())); |
| 866 | |
| 867 | ctx->LinkParent(&out->children[0], out); |
| 868 | out->level_info = current_levels; |
| 869 | // At this point current_levels contains this list as the def level, we need to |
| 870 | // use the previous ancestor of this list. |
| 871 | out->level_info.repeated_ancestor_def_level = repeated_ancestor_def_level; |
| 872 | return Status::OK(); |
| 873 | } else { |
| 874 | current_levels.Increment(node); |
| 875 | return GroupToStruct(node, current_levels, ctx, parent, out); |
| 876 | } |
| 877 | } |
| 878 | |
| 879 | Status NodeToSchemaField(const Node& node, LevelInfo current_levels, |
| 880 | SchemaTreeContext* ctx, const SchemaField* parent, |
no test coverage detected