Skip to main content

Schema

Struct Schema 

Source
pub struct Schema { /* private fields */ }
Expand description

One operator’s output columns.

The fields and the bindings are parallel and always the same length, which Schema::new checks. They are two vectors rather than a vector of pairs because a caller almost always wants one of them whole: the result set wants the names and the types, and the expression evaluator wants to search the bindings.

Implementations§

Source§

impl Schema

Source

pub fn new(fields: Vec<Field>, bindings: Vec<ColumnBinding>) -> Result<Self>

A schema of fields, bound at bindings.

§Errors

If the two are not the same length, which would make a binding resolve to the wrong column or to no column at all.

Source

pub fn numbered(fields: Vec<Field>, table: u32) -> Self

A schema of fields numbered from zero against table.

The common case, since an operator that introduces columns numbers them in the order it produces them and the binder does the same.

§Panics

If there are more than u32::MAX fields, which is the bound a binding’s position already carries.

Source

pub fn empty() -> Self

A schema with no columns, which is what Node::Dummy produces.

Source

pub fn fields(&self) -> &[Field]

The fields, in output order.

Source

pub fn bindings(&self) -> &[ColumnBinding]

The bindings, in output order.

Source

pub fn width(&self) -> usize

How many columns.

Source

pub fn is_empty(&self) -> bool

Whether there are no columns.

Source

pub fn types(&self) -> Vec<LogicalType>

The column types, in order.

Source

pub fn names(&self) -> Vec<String>

The column names, in order.

Source

pub fn position_of(&self, binding: ColumnBinding) -> Option<usize>

Where a binding sits in the output.

A linear scan. An operator’s schema is as wide as the query is, which is tens of columns on the widest ClickBench query, and a hash map of tens of entries rebuilt per operator costs more than the scans it saves.

Source

pub fn concat(left: &Self, right: &Self) -> Self

The left schema’s columns followed by the right schema’s, which is what a join produces.

Trait Implementations§

Source§

impl Clone for Schema

Source§

fn clone(&self) -> Schema

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Schema

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Schema

Source§

impl PartialEq for Schema

Source§

fn eq(&self, other: &Schema) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Schema

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.