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

Method Make

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

Source from the content-addressed store, hash-verified

1274}
1275
1276Status SchemaManifest::Make(const SchemaDescriptor* schema,
1277 const std::shared_ptr<const KeyValueMetadata>& metadata,
1278 const ArrowReaderProperties& properties,
1279 SchemaManifest* manifest) {
1280 SchemaTreeContext ctx;
1281 ctx.manifest = manifest;
1282 ctx.properties = properties;
1283 ctx.schema = schema;
1284 ctx.metadata = metadata;
1285 const GroupNode& schema_node = *schema->group_node();
1286 manifest->descr = schema;
1287 manifest->schema_fields.resize(schema_node.field_count());
1288
1289 // Try to deserialize original Arrow schema
1290 RETURN_NOT_OK(
1291 GetOriginSchema(metadata, &manifest->schema_metadata, &manifest->origin_schema));
1292 // Ignore original schema if it's not compatible with the Parquet schema
1293 if (manifest->origin_schema != nullptr &&
1294 manifest->origin_schema->num_fields() != schema_node.field_count()) {
1295 manifest->origin_schema = nullptr;
1296 }
1297
1298 for (int i = 0; i < static_cast<int>(schema_node.field_count()); ++i) {
1299 SchemaField* out_field = &manifest->schema_fields[i];
1300 RETURN_NOT_OK(NodeToSchemaField(*schema_node.field(i), LevelInfo(), &ctx,
1301 /*parent=*/nullptr, out_field));
1302
1303 // TODO(wesm): as follow up to ARROW-3246, we should really pass the origin
1304 // schema (if any) through all functions in the schema reconstruction, but
1305 // I'm being lazy and just setting dictionary fields at the top level for
1306 // now
1307 if (manifest->origin_schema == nullptr) {
1308 continue;
1309 }
1310
1311 auto& origin_field = manifest->origin_schema->field(i);
1312 RETURN_NOT_OK(ApplyOriginalMetadata(*origin_field, out_field));
1313 }
1314 return Status::OK();
1315}
1316
1317} // namespace parquet::arrow

Callers

nothing calls this directly

Calls 8

GetOriginSchemaFunction · 0.85
NodeToSchemaFieldFunction · 0.85
LevelInfoFunction · 0.85
ApplyOriginalMetadataFunction · 0.85
resizeMethod · 0.80
OKFunction · 0.50
num_fieldsMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected