MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / fold_table_factor

Method fold_table_factor

src/sql/src/names.rs:2166–2224  ·  view source on GitHub ↗
(
        &mut self,
        node: mz_sql_parser::ast::TableFactor<Raw>,
    )

Source from the content-addressed store, hash-verified

2164 }
2165
2166 fn fold_table_factor(
2167 &mut self,
2168 node: mz_sql_parser::ast::TableFactor<Raw>,
2169 ) -> mz_sql_parser::ast::TableFactor<Aug> {
2170 use mz_sql_parser::ast::TableFactor::*;
2171 match node {
2172 Table { name, alias } => Table {
2173 name: self.fold_item_name(name),
2174 alias: alias.map(|alias| self.fold_table_alias(alias)),
2175 },
2176 Function {
2177 function,
2178 alias,
2179 with_ordinality,
2180 } => {
2181 match &function.name {
2182 RawItemName::Name(name) => {
2183 if *name == UnresolvedItemName::unqualified(ident!("values"))
2184 && self.status.is_ok()
2185 {
2186 self.status = Err(PlanError::FromValueRequiresParen);
2187 }
2188 }
2189 RawItemName::Id(..) => {}
2190 }
2191
2192 Function {
2193 function: self.fold_function(function),
2194 alias: alias.map(|alias| self.fold_table_alias(alias)),
2195 with_ordinality,
2196 }
2197 }
2198 RowsFrom {
2199 functions,
2200 alias,
2201 with_ordinality,
2202 } => RowsFrom {
2203 functions: functions
2204 .into_iter()
2205 .map(|f| self.fold_function(f))
2206 .collect(),
2207 alias: alias.map(|alias| self.fold_table_alias(alias)),
2208 with_ordinality,
2209 },
2210 Derived {
2211 lateral,
2212 subquery,
2213 alias,
2214 } => Derived {
2215 lateral,
2216 subquery: Box::new(self.fold_query(*subquery)),
2217 alias: alias.map(|alias| self.fold_table_alias(alias)),
2218 },
2219 NestedJoin { join, alias } => NestedJoin {
2220 join: Box::new(self.fold_table_with_joins(*join)),
2221 alias: alias.map(|alias| self.fold_table_alias(alias)),
2222 },
2223 }

Callers

nothing calls this directly

Calls 6

fold_item_nameMethod · 0.80
fold_functionMethod · 0.80
fold_queryMethod · 0.80
mapMethod · 0.45
collectMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected