Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

follwing sql reports Error during planning: Unsupported operator in the subquery plan. #850

Open
l1t1 opened this issue Sep 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@l1t1
Copy link

l1t1 commented Sep 2, 2024

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.
>>>
@l1t1 l1t1 added the bug Something isn't working label Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant