andygrove commented on a change in pull request #8785: URL: https://github.com/apache/arrow/pull/8785#discussion_r532054884
########## File path: rust/datafusion/src/sql/planner.rs ########## @@ -322,10 +317,80 @@ impl<'a, S: SchemaProvider> SqlToRel<'a, S> { )); } - let plan = self.plan_tables_with_joins(&select.from)?; + let plans = self.plan_from_tables(&select.from)?; - // filter (also known as selection) first - let plan = self.filter(&plan, &select.selection)?; + let plan = match &select.selection { + Some(predicate_expr) => { + // build join schema + let mut fields = vec![]; + for plan in &plans { + let schema = plan.schema(); + for field in schema.fields() { + fields.push(field.clone()); + } + } + let join_schema = Schema::new(fields); Review comment: Thanks @alamb. I will add the check for duplicate column names and merge this once the predicate push-down bug is resolved. After this, I plan on working on table/relation aliases and qualified column names in queries [1]. https://issues.apache.org/jira/browse/ARROW-10732 ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org