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

Function GroupToStruct

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

Source from the content-addressed store, hash-verified

588}
589
590Status 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
620Status ListToSchemaField(const GroupNode& group, LevelInfo current_levels,
621 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