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

Function ListToSchemaField

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

Source from the content-addressed store, hash-verified

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