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

Function GroupToSchemaField

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

Source from the content-addressed store, hash-verified

840}
841
842Status GroupToSchemaField(const GroupNode& node, LevelInfo current_levels,
843 SchemaTreeContext* ctx, const SchemaField* parent,
844 SchemaField* out) {
845 if (node.logical_type()->is_list()) {
846 return ListToSchemaField(node, current_levels, ctx, parent, out);
847 } else if (node.logical_type()->is_map()) {
848 return MapToSchemaField(node, current_levels, ctx, parent, out);
849 }
850 std::shared_ptr<ArrowType> type;
851 if (node.is_repeated()) {
852 // Simple repeated struct
853 //
854 // repeated group $NAME {
855 // r/o TYPE[0] f0
856 // r/o TYPE[1] f1
857 // }
858 out->children.resize(1);
859
860 int16_t repeated_ancestor_def_level = current_levels.IncrementRepeated();
861 RETURN_NOT_OK(GroupToStruct(node, current_levels, ctx, out, &out->children[0]));
862 ARROW_ASSIGN_OR_RAISE(auto list_type,
863 MakeArrowList(out->children[0].field, ctx->properties));
864 out->field = ::arrow::field(node.name(), std::move(list_type),
865 /*nullable=*/false, FieldIdMetadata(node.field_id()));
866
867 ctx->LinkParent(&out->children[0], out);
868 out->level_info = current_levels;
869 // At this point current_levels contains this list as the def level, we need to
870 // use the previous ancestor of this list.
871 out->level_info.repeated_ancestor_def_level = repeated_ancestor_def_level;
872 return Status::OK();
873 } else {
874 current_levels.Increment(node);
875 return GroupToStruct(node, current_levels, ctx, parent, out);
876 }
877}
878
879Status NodeToSchemaField(const Node& node, LevelInfo current_levels,
880 SchemaTreeContext* ctx, const SchemaField* parent,

Callers 1

NodeToSchemaFieldFunction · 0.85

Calls 11

ListToSchemaFieldFunction · 0.85
MapToSchemaFieldFunction · 0.85
GroupToStructFunction · 0.85
is_listMethod · 0.80
is_mapMethod · 0.80
resizeMethod · 0.80
LinkParentMethod · 0.80
fieldFunction · 0.70
FieldIdMetadataFunction · 0.70
OKFunction · 0.50
nameMethod · 0.45

Tested by

no test coverage detected