You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SQL supports ordering within an aggregate function, e.g. SUM(a order by b desc). DataFusion's logical planner does correctly identify this for built-in aggregates, e.g. sum(), max(), min(). However, for UDAFs, it seems to be dropped.
built-in aggregate Logical plan, has ORDER BY:
Projection: SUM(t.a) ORDER BY [t.a DESC NULLS FIRST]
Aggregate: groupBy=[[]], aggr=[[SUM(t.a) ORDER BY [t.a DESC NULLS FIRST]]]
TableScan: t
UDAF Logical plan, missing ORDER BY:
Projection: geo_mean(t.a)
Aggregate: groupBy=[[]], aggr=[[geo_mean(t.a)]]
TableScan: t
To Reproduce
Register a UDAF, write a query with ordering inside it, and inspect the logical plan.
Expected behavior
The UDAF expression should have a non-empty order_by clause.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Thank you for the report @jacksonrnewhouse -- I hope to investigate more fully at some point. Any additional debugging insight you have would be most helpful
Describe the bug
SQL supports ordering within an aggregate function, e.g.
SUM(a order by b desc)
. DataFusion's logical planner does correctly identify this for built-in aggregates, e.g.sum()
,max()
,min()
. However, for UDAFs, it seems to be dropped.I've written up an example here: https://github.com/ArroyoSystems/arrow-datafusion/blob/92e92b9e971bc407b39de2ce8c9bc793355168f7/datafusion-examples/examples/simple_udaf.rs#L174.
The output is
To Reproduce
Register a UDAF, write a query with ordering inside it, and inspect the logical plan.
Expected behavior
The UDAF expression should have a non-empty
order_by
clause.Additional context
No response
The text was updated successfully, but these errors were encountered: