konjac opened a new issue, #1014:
URL: https://github.com/apache/datafusion-python/issues/1014

   **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.
   


-- 
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: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to