(
&mut self,
catalog: &dyn SqlCatalog,
factor: &sqlparser::ast::TableFactor,
)
| 166 | } |
| 167 | |
| 168 | fn resolve_table_factor( |
| 169 | &mut self, |
| 170 | catalog: &dyn SqlCatalog, |
| 171 | factor: &sqlparser::ast::TableFactor, |
| 172 | ) -> Result<()> { |
| 173 | // ARRAY_*(...) table-valued function: synthesize a ResolvedTable |
| 174 | // from the array's dim+attr schema so equi-join keys against the |
| 175 | // TVF's output rows resolve. |
| 176 | if let Some(resolved) = resolve_array_tvf(catalog, factor)? { |
| 177 | self.add(resolved)?; |
| 178 | return Ok(()); |
| 179 | } |
| 180 | // LATERAL derived subquery: register the alias as a schemaless |
| 181 | // collection so qualified column references (`alias.col`) resolve |
| 182 | // without a catalog lookup. The actual inner plan is built separately. |
| 183 | if let sqlparser::ast::TableFactor::Derived { |
| 184 | lateral: true, |
| 185 | alias: Some(alias), |
| 186 | .. |
| 187 | } = factor |
| 188 | { |
| 189 | let alias_str = normalize_ident(&alias.name); |
| 190 | self.add(ResolvedTable { |
| 191 | name: alias_str.clone(), |
| 192 | alias: Some(alias_str.clone()), |
| 193 | info: CollectionInfo { |
| 194 | name: alias_str, |
| 195 | engine: EngineType::DocumentSchemaless, |
| 196 | columns: Vec::new(), |
| 197 | primary_key: None, |
| 198 | has_auto_tier: false, |
| 199 | indexes: Vec::new(), |
| 200 | bitemporal: false, |
| 201 | primary: nodedb_types::PrimaryEngine::Document, |
| 202 | vector_primary: None, |
| 203 | }, |
| 204 | })?; |
| 205 | return Ok(()); |
| 206 | } |
| 207 | if let Some((name, alias)) = table_name_from_factor(factor)? { |
| 208 | let info = catalog |
| 209 | .get_collection(DatabaseId::DEFAULT, &name)? |
| 210 | .ok_or_else(|| SqlError::UnknownTable { name: name.clone() })?; |
| 211 | self.add(ResolvedTable { name, alias, info })?; |
| 212 | } |
| 213 | Ok(()) |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | /// If `factor` is `ARRAY_*(name, ...)`, look up the array via the |
no test coverage detected