jonahgao commented on code in PR #10876: URL: https://github.com/apache/datafusion/pull/10876#discussion_r1636588528
########## datafusion/core/src/catalog/mod.rs: ########## @@ -295,6 +296,118 @@ impl CatalogProvider for MemoryCatalogProvider { } } +/// Resolve all table references in the SQL statement. +/// +/// ## Example +/// +/// ``` +/// use datafusion_sql::parser::DFParser; +/// use datafusion::catalog::resolve_table_references; +/// +/// let query = "SELECT a FROM foo where x IN (SELECT y FROM bar)"; +/// let statement = DFParser::parse_sql(query).unwrap().pop_back().unwrap(); +/// let table_refs = resolve_table_references(&statement, true).unwrap(); +/// assert_eq!(table_refs.len(), 2); +/// assert_eq!(table_refs[0].to_string(), "foo"); +/// assert_eq!(table_refs[1].to_string(), "bar"); +/// ``` +pub fn resolve_table_references( + statement: &datafusion_sql::parser::Statement, + enable_ident_normalization: bool, +) -> datafusion_common::Result<Vec<TableReference>> { Review Comment: This function will return CTEs, and users who use it may need to be aware of this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org