Open
Description
Describe the bug
when I run following sql, it reports Error during planning: Unsupported operator in the subquery plan.
To Reproduce
create table rectangle as select i id, (random()*99)::int+1 height from unnest(generate_series(1,1000,1))t(i);
sss="""
with t as
(
select left1,width1,min(height)min_height
from
rectangle a cross join unnest(generate_series(1,1000,1))t(left1)cross join unnest(generate_series(1,1000,1))t1(width1)
where left1+width1-1<=1000
and id between left1 and left1+width1-1
group by left1,width1
)
select *,min_height*width1 from t where min_height*width1 = (select max(min_height*width1)from t);
"""
Expected behavior
it runs as normal
Additional context
the error log
Python 3.12.2 (tags/v3.12.2:6abddd9, Feb 6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import datafusion
>>> from datafusion import SessionContext
>>> ctx = SessionContext()
>>> datafusion.__version__
'40.1.0'
>>> ctx.sql("create table rectangle as select i id, (random()*99)::int+1 height from unnest(generate_series(1,1000,1))t(i);")
DataFrame()
++
++
>>> ctx.sql("select * from rectangle limit 4")
DataFrame()
+----+--------+
| id | height |
+----+--------+
| 1 | 78 |
| 2 | 64 |
| 3 | 56 |
| 4 | 79 |
+----+--------+
>>> sss="""
... with t as
... (
... select left1,width1,min(height)min_height
... from
... rectangle a cross join unnest(generate_series(1,1000,1))t(left1)cross join unnest(generate_series(1,1000,1))t1(width1)
... where left1+width1-1<=1000
... and id between left1 and left1+width1-1
... group by left1,width1
... )
... select *,min_height*width1 from t where min_height*width1 = (select max(min_height*width1)from t);
... """
>>> ctx.sql(sss)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python312\Lib\site-packages\datafusion\dataframe.py", line 73, in __repr__
return self.df.__repr__()
^^^^^^^^^^^^^^^^^^
Exception: check_analyzed_plan
caused by
Error during planning: Unsupported operator in the subquery plan.
>>>