pub struct ScopedTable {
pub table: Arc<TableMetadata>,
pub start_index: usize,
pub scope_level: usize,
pub hidden_unqualified_columns: HashSet<String>,
pub merged_column_partners: HashMap<String, Vec<usize>>,
/* private fields */
}Expand description
A table visible to expression name resolution.
The metadata is shared rather than owned: every enclosing scope is copied into each nested scope, and copying whole schemas there made resolution cost grow with the square of the nesting depth.
Fields§
§table: Arc<TableMetadata>§start_index: usize§scope_level: usizeLexical nesting level; zero is the current SELECT and larger values are successively enclosing SELECT scopes.
Columns coalesced by a JOIN … USING or NATURAL JOIN. They remain addressable by a qualified right-hand reference, but are not candidates for an unqualified reference because the merged output column owns the name.
merged_column_partners: HashMap<String, Vec<usize>>For a column merged by USING or NATURAL, the output indexes of every
other side. An unqualified reference to a merged name resolves to
COALESCE(left, right, ...) so that RIGHT and FULL joins report the key
from whichever joined input is present.
Implementations§
Source§impl ScopedTable
impl ScopedTable
pub fn new(table: impl Into<Arc<TableMetadata>>, start_index: usize) -> Self
Sourcepub fn column_position(&self, column: &str) -> Option<usize>
pub fn column_position(&self, column: &str) -> Option<usize>
Position of column in this table, or None if it has no such column.
pub fn hide_unqualified_columns(&mut self, columns: &[String])
Sourcepub fn merge_column_with(&mut self, column: &str, partner_index: usize)
pub fn merge_column_with(&mut self, column: &str, partner_index: usize)
Record that column is merged with the output column at partner_index.
Trait Implementations§
Source§impl Clone for ScopedTable
impl Clone for ScopedTable
Source§fn clone(&self) -> ScopedTable
fn clone(&self) -> ScopedTable
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more