2010YOUY01 commented on PR #11469: URL: https://github.com/apache/datafusion/pull/11469#issuecomment-2227896445
> > Thank you for the new feature, I have some thoughts for an alternative design: > > Recursive aggregate functions are generally unsupported: e.g. `select sum(sum(v1)) from t1` is not supported in DataFusion/Postgres/DuckDB. For this `unnest()` case, a recursive call is required, DuckDB uses: https://duckdb.org/docs/sql/query_syntax/unnest.html#recursive-unnest > > What do you think about implementing DuckDB syntax, I think it's better for: > > > > 1. Keep the SQL syntax consistent and avoid nested aggregate function > > 2. Avoid changing planner code (which might be error-prone), and keep the recursive unnest logic within the aggregate function body > > Thank you for your reply. > > 1 If "keep the recursive unnest logic within the aggregate function body" is implemented, at least the following work needs to be done: (1) Improve the logic of `Expr::Unnest` processing in `TypeCoercionRewriter`; (2) Implement `create_physical_expr` function to support `Expr::Unnest`; (3) Maybe there are other tasks... Also, I would like to check whether you are talking about `aggregate function` or `AggregateExec` here. Because pg currently does not support aggregation functions that include `unnest`. (Of course, it is not appropriate to illustrate this issue only by pg here) > > 2 If 'Recursive Unnest' is handled like DuckDB, how do we implement the unnest(unnest(list_column)) syntax when the user needs it? By optimization rules? @JasonLi-cn I mistakenly thought `unnest` was some aggregate function... please ignore my previous reply, and also sorry for the confusion. -- 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