Closed
Description
Describe the bug
union all +aggregate function in the recursive cte results an infinite loop
To Reproduce
Steps to reproduce the behavior:
import datafusion
from datafusion import SessionContext
ctx = SessionContext()
df = ctx.sql("""
with recursive t as(select value i,1 lv from generate_series(1,6,1)
union all
select max(i),max(lv)+1 from t where lv<2)
select * from t where lv=2;
""")
>>> print(df)
Expected behavior
it outputs
DataFrame()
+---+----+
| i | lv |
+---+----+
| 6 | 2 |
+---+----+
Additional context
Add any other context about the problem here.