alamb opened a new pull request #744:
URL: https://github.com/apache/arrow-datafusion/pull/744
# Which issue does this PR close?
Closes https://github.com/apache/arrow-datafusion/issues/221
# Rationale for this change
"The EXPLAIN command is useful to show the plan of the query engine.
However, the current output shows the un-optimized logical plan, which is not
very useful as it maps almost 1:1 to the query."
Most users issue an `EXPLAIN` command to see what the query engine is
actually going to run.
# What changes are included in this PR?
Change EXPLAIN to show the optimized logical plan (after all logical
optimizer passes) and optimized physical plan (after all physical optimizer
passes).
Working with sql.rs reminded me of my goal for cleaning up sql tests, and so
I filed https://github.com/apache/arrow-datafusion/issues/743
# Are there any user-facing changes?
Explain plan output is different
For example, before this PR
```
> EXPLAIN SELECT c2 from foo;
+--------------+----------------------------------+
| plan_type | plan |
+--------------+----------------------------------+
| logical_plan | Projection: #foo.c2 |
| | TableScan: foo projection=None |
+--------------+----------------------------------+
1 row in set. Query took 0.002 seconds.
```
and after this PR (note the inclusion of the projection pushdown and
physical plan)
```
> EXPLAIN SELECT c2 from foo;
+---------------+--------------------------------------------------------------------------+
| plan_type | plan
|
+---------------+--------------------------------------------------------------------------+
| logical_plan | Projection: #foo.c2
|
| | TableScan: foo projection=Some([1])
|
| physical_plan | ProjectionExec: expr=[c2@0 as c2]
|
| | RepartitionExec: partitioning=RoundRobinBatch(16)
|
| | CsvExec: source=Path(/tmp/foo.csv: [/tmp/foo.csv]),
has_header=false |
+---------------+--------------------------------------------------------------------------+
```
--
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]