alamb commented on code in PR #7040:
URL: https://github.com/apache/arrow-datafusion/pull/7040#discussion_r1276232108
##########
datafusion/sql/src/select.rs:
##########
@@ -431,6 +432,37 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
group_by_exprs: Vec<Expr>,
aggr_exprs: Vec<Expr>,
) -> Result<(LogicalPlan, Vec<Expr>, Option<Expr>)> {
+ let schema = input.schema();
Review Comment:
> What do you think about extending group by expression in all cases,
without checking for select exprs. I think this is a bit confusing.
I agree
> In short, functional dependency can be calculated without external
information. However, query rewrite cannot be done without resorting to the
information in the select exprs in current design.
I think this is the key point I was missing -- that the code in the sql
planner is actually doing a SQL level rewrite. Thank you for clarifying.
What would you think about pulling the rewrite code into its own function
and adding a clear explanation of what it was doing (basically copy/paste your
example from above)?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]