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

Function GroupToSchemaField

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

Source from the content-addressed store, hash-verified

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