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
impl Schema
Sourcepub fn new(fields: Vec<Field>, bindings: Vec<ColumnBinding>) -> Result<Self>
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.
Sourcepub fn numbered(fields: Vec<Field>, table: u32) -> Self
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.
Sourcepub fn empty() -> Self
pub fn empty() -> Self
A schema with no columns, which is what Node::Dummy produces.
Sourcepub fn bindings(&self) -> &[ColumnBinding]
pub fn bindings(&self) -> &[ColumnBinding]
The bindings, in output order.
Sourcepub fn types(&self) -> Vec<LogicalType>
pub fn types(&self) -> Vec<LogicalType>
The column types, in order.
Sourcepub fn position_of(&self, binding: ColumnBinding) -> Option<usize>
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.