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

Function UnifySchemas

cpp/src/arrow/type.cc:2695–2717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2693}
2694
2695Result<std::shared_ptr<Schema>> UnifySchemas(
2696 const std::vector<std::shared_ptr<Schema>>& schemas,
2697 const Field::MergeOptions field_merge_options) {
2698 if (schemas.empty()) {
2699 return Status::Invalid("Must provide at least one schema to unify.");
2700 }
2701
2702 if (!schemas[0]->HasDistinctFieldNames()) {
2703 return Status::Invalid("Can't unify schema with duplicate field names.");
2704 }
2705
2706 SchemaBuilder builder{schemas[0], SchemaBuilder::CONFLICT_MERGE, field_merge_options};
2707
2708 for (size_t i = 1; i < schemas.size(); i++) {
2709 const auto& schema = schemas[i];
2710 if (!schema->HasDistinctFieldNames()) {
2711 return Status::Invalid("Can't unify schema with duplicate field names.");
2712 }
2713 RETURN_NOT_OK(builder.AddSchema(schema));
2714 }
2715
2716 return builder.Finish();
2717}
2718
2719// ----------------------------------------------------------------------
2720// Fingerprint computations

Callers 4

ConcatenateTablesFunction · 0.85
TEST_FFunction · 0.85
InspectMethod · 0.85
arrow__UnifySchemasFunction · 0.85

Calls 6

HasDistinctFieldNamesMethod · 0.80
AddSchemaMethod · 0.80
InvalidFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45
FinishMethod · 0.45

Tested by 1

TEST_FFunction · 0.68