Jefffrey opened a new issue, #589:
URL: https://github.com/apache/arrow-datafusion-python/issues/589

   **Describe the bug**
   
   Original issue from datafusion repository: 
https://github.com/apache/arrow-datafusion/issues/9319
   
   Error when doing explain directly in SQL.
   
   **To Reproduce**
   
   Using latest available version on Pypi (35.0.0)
   
   ```python
   >>> import datafusion
   >>> ctx = datafusion.SessionContext()
   >>> ctx.sql("explain select 1")
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
   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 `ctx.sql("explain select 1")` should ideally succeed, as it works in 
regular DataFusion:
   
   ```rust
       let ctx = SessionContext::new();
       let df = ctx.sql("explain select 1").await?;
       df.show().await?;
   ```
   
   Will output:
   
   ```
   +---------------+--------------------------------------+
   | 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to