MCPcopy Create free account
hub / github.com/apache/datafusion / join

Method join

datafusion/common/src/dfschema.rs:287–307  ·  view source on GitHub ↗

Create a new schema that contains the fields from this schema followed by the fields from the supplied schema. An error will be returned if there are duplicate field names.

(&self, schema: &DFSchema)

Source from the content-addressed store, hash-verified

285 /// Create a new schema that contains the fields from this schema followed by the fields
286 /// from the supplied schema. An error will be returned if there are duplicate field names.
287 pub fn join(&self, schema: &DFSchema) -> Result<Self> {
288 let mut schema_builder = SchemaBuilder::new();
289 schema_builder.extend(self.inner.fields().iter().cloned());
290 schema_builder.extend(schema.fields().iter().cloned());
291 let new_schema = schema_builder.finish();
292
293 let mut new_metadata = self.inner.metadata.clone();
294 new_metadata.extend(schema.inner.metadata.clone());
295 let new_schema_with_metadata = new_schema.with_metadata(new_metadata);
296
297 let mut new_qualifiers = self.field_qualifiers.clone();
298 new_qualifiers.extend_from_slice(schema.field_qualifiers.as_slice());
299
300 let new_self = Self {
301 inner: Arc::new(new_schema_with_metadata),
302 field_qualifiers: new_qualifiers,
303 functional_dependencies: FunctionalDependencies::empty(),
304 };
305 new_self.check_names()?;
306 Ok(new_self)
307 }
308
309 /// Modify this schema by appending the fields from the supplied schema, ignoring any
310 /// duplicate fields.

Calls 10

newFunction · 0.85
check_namesMethod · 0.80
emptyFunction · 0.50
extendMethod · 0.45
clonedMethod · 0.45
iterMethod · 0.45
fieldsMethod · 0.45
finishMethod · 0.45
cloneMethod · 0.45
with_metadataMethod · 0.45