MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / concat

Method concat

src/repr/src/relation.rs:1152–1179  ·  view source on GitHub ↗

Concatenates a `RelationDesc` onto the end of this `RelationDesc`. # Panics Panics if either `self` or `other` have columns that were added at a [`RelationVersion`] other than [`RelationVersion::root`] or if any columns were dropped. TODO(parkmycar): Move this method to [`RelationDescBuilder`].

(mut self, other: Self)

Source from the content-addressed store, hash-verified

1150 ///
1151 /// TODO(parkmycar): Move this method to [`RelationDescBuilder`].
1152 pub fn concat(mut self, other: Self) -> Self {
1153 let self_len = self.typ.column_types.len();
1154
1155 for (typ, (_col_idx, meta)) in other.typ.column_types.into_iter().zip_eq(other.metadata) {
1156 assert_eq!(meta.added, RelationVersion::root());
1157 assert_none!(meta.dropped);
1158
1159 let new_idx = self.typ.columns().len();
1160 let new_meta = ColumnMetadata {
1161 name: meta.name,
1162 typ_idx: new_idx,
1163 added: RelationVersion::root(),
1164 dropped: None,
1165 };
1166
1167 self.typ.column_types.push(typ);
1168 let prev = self.metadata.insert(ColumnIndex(new_idx), new_meta);
1169
1170 assert_eq!(self.metadata.len(), self.typ.columns().len());
1171 assert_none!(prev);
1172 }
1173
1174 for k in other.typ.keys {
1175 let k = k.into_iter().map(|idx| idx + self_len).collect();
1176 self = self.with_key(k);
1177 }
1178 self
1179 }
1180
1181 /// Adds a new key for the relation.
1182 pub fn with_key(mut self, indices: Vec<usize>) -> Self {

Callers 15

handleArrayFunction · 0.45
handleObjectFunction · 0.45
describe_subscribeFunction · 0.45
to_json_generic_enumFunction · 0.45
build_ingestion_dataflowFunction · 0.45
renderMethod · 0.45
renderMethod · 0.45
renderMethod · 0.45
renderFunction · 0.45
renderFunction · 0.45
renderFunction · 0.45
renderFunction · 0.45

Calls 10

ColumnIndexClass · 0.85
with_keyMethod · 0.80
lenMethod · 0.45
into_iterMethod · 0.45
columnsMethod · 0.45
pushMethod · 0.45
insertMethod · 0.45
collectMethod · 0.45
mapMethod · 0.45
extendMethod · 0.45

Tested by 1

evolve_builtin_descFunction · 0.36