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
Describe the bug
EXPLAIN statement could not be printed with the following error.
Exception: Internal error: Unsupported logical plan: Explain must be root of the plan.
This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker
To Reproduce
Steps to reproduce the behavior:
>>> from datafusion import SessionContext
>>> ctx = SessionContext()
>>> ctx.sql("explain select 1")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/kuhuan/.local/lib/python3.10/site-packages/datafusion/dataframe.py", line 71, in __repr__
return self.df.__repr__()
Exception: Internal error: Unsupported logical plan: Explain must be root of the plan.
This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker
Expected behavior
The output should just be like using explain function
Import the SessionContext from the datafusion library.
Create a session context.
Execute an EXPLAIN statement using ctx.sql("explain select 1").
from datafusion import SessionContext
ctx = SessionContext()
ctx.sql("explain select 1")
Expected Behavior
The expected behavior is that the EXPLAIN statement should return a detailed explanation of the execution plan for the query, similar to what is produced by the .explain() method on a DataFrame:
ctx.sql("select 1").explain()
This should output something like:
+---------------+--------------------------------------+
| plan_type | plan |
+---------------+--------------------------------------+
| logical_plan | Projection: Int64(1) |
| | EmptyRelation |
| physical_plan | ProjectionExec: expr=[1 as Int64(1)] |
| | PlaceholderRowExec |
| | |
+---------------+--------------------------------------+
Describe the bug
EXPLAIN statement could not be printed with the following error.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The output should just be like using explain function
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: