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

Method build_schema

datafusion/sql/src/planner.rs:483–502  ·  view source on GitHub ↗
(&self, columns: Vec<SQLColumnDef>)

Source from the content-addressed store, hash-verified

481 }
482
483 pub fn build_schema(&self, columns: Vec<SQLColumnDef>) -> Result<Schema> {
484 let mut fields = Vec::with_capacity(columns.len());
485
486 for column in columns {
487 let data_type = self.convert_data_type_to_field(&column.data_type)?;
488 let not_nullable = column
489 .options
490 .iter()
491 .any(|x| x.option == ColumnOption::NotNull);
492 fields.push(
493 data_type
494 .as_ref()
495 .clone()
496 .with_name(self.ident_normalizer.normalize(column.name))
497 .with_nullable(!not_nullable),
498 );
499 }
500
501 Ok(Schema::new(fields))
502 }
503
504 /// Returns a vector of (column_name, default_expr) pairs
505 pub(super) fn build_column_defaults(

Calls 11

newFunction · 0.85
lenMethod · 0.45
anyMethod · 0.45
iterMethod · 0.45
pushMethod · 0.45
with_nullableMethod · 0.45
with_nameMethod · 0.45
cloneMethod · 0.45
as_refMethod · 0.45
normalizeMethod · 0.45

Tested by

no test coverage detected