MCPcopy Create free account
hub / github.com/apache/arrow / GroupToStruct

Function GroupToStruct

cpp/src/parquet/arrow/schema.cc:587–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

ResolveListFunction · 0.85
GroupToSchemaFieldFunction · 0.85

Calls 13

NodeToSchemaFieldFunction · 0.85
struct_Function · 0.85
GetExtensionTypeFunction · 0.85
resizeMethod · 0.80
push_backMethod · 0.80
is_variantMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
fieldFunction · 0.70
FieldIdMetadataFunction · 0.70
OKFunction · 0.50
fieldMethod · 0.45
DeserializeMethod · 0.45

Tested by

no test coverage detected