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

Unable to print EXPLAIN #1014

Open
konjac opened this issue Feb 5, 2025 · 0 comments · May be fixed by #1015
Open

Unable to print EXPLAIN #1014

konjac opened this issue Feb 5, 2025 · 0 comments · May be fixed by #1015
Labels
bug Something isn't working

Comments

@konjac
Copy link

konjac commented Feb 5, 2025

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

>>> ctx.sql("select 1").explain()
DataFrame()
+---------------+--------------------------------------+
| plan_type     | plan                                 |
+---------------+--------------------------------------+
| logical_plan  | Projection: Int64(1)                 |
|               |   EmptyRelation                      |
| physical_plan | ProjectionExec: expr=[1 as Int64(1)] |
|               |   PlaceholderRowExec                 |
|               |                                      |
+---------------+--------------------------------------+

Additional context
Add any other context about the problem here.

@konjac konjac added the bug Something isn't working label Feb 5, 2025
@konjac konjac linked a pull request Feb 5, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant