Skip to content

Commit 2d11023

Browse files
committed
fix ontology link names and MapsTo confusion in mz_object_global_ids
1 parent 8826e9d commit 2d11023

1 file changed

Lines changed: 9 additions & 26 deletions

File tree

src/catalog/src/builtin.rs

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,11 @@ impl LinkProperties {
472472
/// kind of relationship.
473473
#[derive(Clone, Debug, Hash, PartialEq, Eq, Serialize)]
474474
pub struct OntologyLink {
475-
/// Relationship name (e.g., "owned_by", "in_schema").
475+
/// Relationship name describing the relationship FROM this entity TO the
476+
/// target (e.g., `"owned_by"` means "this entity is owned by the target",
477+
/// `"depends_on"` means "this entity depends on the target"). When the
478+
/// same name appears on multiple links of the same entity, all links
479+
/// share that relationship role (e.g., several `"union_includes"` links).
476480
pub name: &'static str,
477481
/// Target entity name (e.g., "role", "schema").
478482
pub target: &'static str,
@@ -8389,20 +8393,6 @@ UNION ALL
83898393
target: "secret",
83908394
properties: LinkProperties::union_disc("type", "secret"),
83918395
},
8392-
OntologyLink {
8393-
name: "maps_to_global_id",
8394-
target: "object",
8395-
properties: LinkProperties::MapsTo {
8396-
source_column: "id",
8397-
target_column: "global_id",
8398-
via: Some("mz_internal.mz_object_global_ids"),
8399-
from_type: Some(mz_repr::SemanticType::CatalogItemId),
8400-
to_type: Some(mz_repr::SemanticType::GlobalId),
8401-
note: Some(
8402-
"A CatalogItemId (SQL layer) maps to one or more GlobalIds (runtime layer).",
8403-
),
8404-
},
8405-
},
84068396
OntologyLink {
84078397
name: "in_schema",
84088398
target: "schema",
@@ -8555,16 +8545,9 @@ pub static MZ_OBJECT_GLOBAL_IDS: LazyLock<BuiltinTable> = LazyLock::new(|| Built
85558545
description: "Mapping between CatalogItemId (SQL layer) and GlobalId (runtime layer)",
85568546
links: &const {
85578547
[OntologyLink {
8558-
name: "has_global_id",
8548+
name: "id_references",
85598549
target: "object",
8560-
properties: LinkProperties::MapsTo {
8561-
source_column: "id",
8562-
target_column: "id",
8563-
via: None,
8564-
from_type: Some(mz_repr::SemanticType::CatalogItemId),
8565-
to_type: Some(mz_repr::SemanticType::GlobalId),
8566-
note: None,
8567-
},
8550+
properties: LinkProperties::fk("id", "id", Cardinality::ManyToOne),
85688551
}]
85698552
},
85708553
column_semantic_types: &[("id", SemanticType::CatalogItemId)],
@@ -15669,7 +15652,7 @@ JOIN mz_catalog.mz_relations r ON (r.id = d.referenced_object_id)",
1566915652
links: &const {
1567015653
[
1567115654
OntologyLink {
15672-
name: "materialization_depends_on",
15655+
name: "depends_on",
1567315656
target: "object",
1567415657
properties: LinkProperties::DependsOn {
1567515658
source_column: "object_id",
@@ -15679,7 +15662,7 @@ JOIN mz_catalog.mz_relations r ON (r.id = d.referenced_object_id)",
1567915662
},
1568015663
},
1568115664
OntologyLink {
15682-
name: "materialization_dependency",
15665+
name: "dependency_is",
1568315666
target: "object",
1568415667
properties: LinkProperties::fk("dependency_id", "id", Cardinality::ManyToOne),
1568515668
},

0 commit comments

Comments
 (0)