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

Function ListToSchemaField

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

Source from the content-addressed store, hash-verified

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

Callers 3

MapToSchemaFieldFunction · 0.85
ResolveListFunction · 0.85
GroupToSchemaFieldFunction · 0.85

Calls 8

ResolveListFunction · 0.85
resizeMethod · 0.80
LinkParentMethod · 0.80
fieldFunction · 0.70
FieldIdMetadataFunction · 0.70
InvalidFunction · 0.50
OKFunction · 0.50
nameMethod · 0.45

Tested by

no test coverage detected