| 588 | } |
| 589 | |
| 590 | Status GroupToStruct(const GroupNode& node, LevelInfo current_levels, |
| 591 | SchemaTreeContext* ctx, const SchemaField* parent, |
| 592 | SchemaField* out) { |
| 593 | std::vector<std::shared_ptr<Field>> arrow_fields; |
| 594 | out->children.resize(node.field_count()); |
| 595 | // All level increments for the node are expected to happen by callers. |
| 596 | // This is required because repeated elements need to have their own |
| 597 | // SchemaField. |
| 598 | |
| 599 | for (int i = 0; i < node.field_count(); i++) { |
| 600 | RETURN_NOT_OK( |
| 601 | NodeToSchemaField(*node.field(i), current_levels, ctx, out, &out->children[i])); |
| 602 | arrow_fields.push_back(out->children[i].field); |
| 603 | } |
| 604 | auto struct_type = ::arrow::struct_(arrow_fields); |
| 605 | if (ctx->properties.get_arrow_extensions_enabled() && |
| 606 | node.logical_type()->is_variant()) { |
| 607 | auto extension_type = ::arrow::GetExtensionType("arrow.parquet.variant"); |
| 608 | if (extension_type) { |
| 609 | ARROW_ASSIGN_OR_RAISE( |
| 610 | struct_type, |
| 611 | extension_type->Deserialize(std::move(struct_type), /*serialized_data=*/"")); |
| 612 | } |
| 613 | } |
| 614 | out->field = ::arrow::field(node.name(), struct_type, node.is_optional(), |
| 615 | FieldIdMetadata(node.field_id())); |
| 616 | out->level_info = current_levels; |
| 617 | return Status::OK(); |
| 618 | } |
| 619 | |
| 620 | Status ListToSchemaField(const GroupNode& group, LevelInfo current_levels, |
| 621 | SchemaTreeContext* ctx, const SchemaField* parent, |
no test coverage detected