Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Add PyDataFrame.explain #36

Merged
merged 3 commits into from
Mar 10, 2022
Merged

Add PyDataFrame.explain #36

merged 3 commits into from
Mar 10, 2022

Conversation

andygrove
Copy link
Contributor

@andygrove andygrove commented Mar 10, 2022

Closes #35

This PR adds the explain method to PyDataFrame.

>>> from datafusion import ExecutionContext
>>> ctx = ExecutionContext()
>>> ctx.register_parquet("store_sales", "/mnt/bigdata/tpcds/sf100-parquet/store_sales.dat")
>>> df = ctx.sql("SELECT count(*) FROM store_sales")
>>> df.explain()
+---------------+-------------------------------------------------------------+
| plan_type     | plan                                                        |
+---------------+-------------------------------------------------------------+
| logical_plan  | Projection: #COUNT(UInt8(1))                                |
|               |   Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]]         |
|               |     TableScan: store_sales projection=Some([0])             |
| physical_plan | ProjectionExec: expr=[COUNT(UInt8(1))@0 as COUNT(UInt8(1))] |
|               |   ProjectionExec: expr=[287997024 as COUNT(UInt8(1))]       |
|               |     EmptyExec: produce_one_row=true                         |
|               |                                                             |
+---------------+-------------------------------------------------------------+

@andygrove andygrove requested a review from jimexist March 10, 2022 01:00
@andygrove andygrove marked this pull request as draft March 10, 2022 01:18
@andygrove andygrove marked this pull request as ready for review March 10, 2022 01:21
@jimexist jimexist merged commit 3f2bd29 into datafusion-contrib:main Mar 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement DataFrame.explain
2 participants