l1t1 opened a new issue, #1131:
URL: https://github.com/apache/datafusion-python/issues/1131
**Describe the bug**
union all +aggregate function in the recursive cte results an infinite loop
**To Reproduce**
Steps to reproduce the behavior:
```python
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.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]