alamb commented on a change in pull request #8785: URL: https://github.com/apache/arrow/pull/8785#discussion_r532035179
########## 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: I am not sure how this code handles duplicated column names in the two inputs. TPCH helpfully prefixes id columns with the relation (e.g. `l_orderkey` and `o_orderkey`) but in many real world inputs both tables would probably have a column named `orderkey`) ---------------------------------------------------------------- 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