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

Method new

datafusion/datasource/src/table_schema.rs:119–127  ·  view source on GitHub ↗

Create a new TableSchema from a file schema and partition columns. The table schema is automatically computed by appending the partition columns to the file schema. You should prefer calling this method over chaining [`TableSchema::from_file_schema`] and [`TableSchema::with_table_partition_cols`] if you have both the file schema and partition columns available at construction time since it avoid

(file_schema: SchemaRef, table_partition_cols: Vec<FieldRef>)

Source from the content-addressed store, hash-verified

117 /// assert_eq!(table_schema.table_schema().fields().len(), 4);
118 /// ```
119 pub fn new(file_schema: SchemaRef, table_partition_cols: Vec<FieldRef>) -> Self {
120 let mut builder = SchemaBuilder::from(file_schema.as_ref());
121 builder.extend(table_partition_cols.iter().cloned());
122 Self {
123 file_schema,
124 table_partition_cols: Arc::new(table_partition_cols),
125 table_schema: Arc::new(builder.finish()),
126 }
127 }
128
129 /// Create a new TableSchema with no partition columns.
130 ///

Callers

nothing calls this directly

Calls 6

newFunction · 0.85
as_refMethod · 0.45
extendMethod · 0.45
clonedMethod · 0.45
iterMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected