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

fix: adds more information when an EXPLAIN <query> is run on a federated source #34

Merged

Conversation

phillipleblanc
Copy link
Collaborator

I wanted an easy way to be able to quickly check what SQL is actually being sent to a remote SQLExecutor, as well as the logical plan that was being federated.

Ideally we could have more information about the compute context at the LogicalPlan level, but I'm not 100% sure what makes sense yet.

Sample output:
EXPLAIN="true" cargo run --example sqlite

+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| plan_type     | plan                                                                                                                                                                                                                                                                                                                                                                     |
+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| logical_plan  | Federated                                                                                                                                                                                                                                                                                                                                                                |
|               |  Limit: skip=0, fetch=10                                                                                                                                                                                                                                                                                                                                                 |
|               |   Projection: t.trackid, t.name AS trackname, a.title AS albumtitle, ar.name AS artistname                                                                                                                                                                                                                                                                               |
|               |     Inner Join:  Filter: a.artistid = ar.artistid                                                                                                                                                                                                                                                                                                                        |
|               |       Inner Join:  Filter: t.albumid = a.albumid                                                                                                                                                                                                                                                                                                                         |
|               |         SubqueryAlias: t                                                                                                                                                                                                                                                                                                                                                 |
|               |           TableScan: track                                                                                                                                                                                                                                                                                                                                               |
|               |         SubqueryAlias: a                                                                                                                                                                                                                                                                                                                                                 |
|               |           TableScan: album                                                                                                                                                                                                                                                                                                                                               |
|               |       SubqueryAlias: ar                                                                                                                                                                                                                                                                                                                                                  |
|               |         TableScan: artist                                                                                                                                                                                                                                                                                                                                                |
| physical_plan | VirtualExecutionPlan name=connector_x_executor compute_context=sqlite://./examples/examples/chinook.sqlite sql=SELECT "t"."trackid", "t"."name" AS "trackname", "a"."title" AS "albumtitle", "ar"."name" AS "artistname" FROM "track" AS "t" JOIN "album" AS "a" ON ("t"."albumid" = "a"."albumid") JOIN "artist" AS "ar" ON ("a"."artistid" = "ar"."artistid") LIMIT 10 |
|               |                                                                                                                                                                                                                                                                                                                                                                          |
+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

@phillipleblanc phillipleblanc changed the title Adds more information when an EXPLAIN <query> is run on a federated source fix: Adds more information when an EXPLAIN <query> is run on a federated source May 8, 2024
@phillipleblanc phillipleblanc changed the title fix: Adds more information when an EXPLAIN <query> is run on a federated source fix: adds more information when an EXPLAIN <query> is run on a federated source May 8, 2024
@backkem backkem merged commit b1007dd into datafusion-contrib:main May 8, 2024
9 of 11 checks passed
@phillipleblanc phillipleblanc deleted the phillip/240508-explain branch May 8, 2024 11:53
phillipleblanc added a commit that referenced this pull request Jan 10, 2025
…et in `rewrite_table_scans` (#34)

* fix: handle LogicalPlan::Limit separately to preserve skip and offset in rewrite_table_scans

* Update sources/sql/src/lib.rs

---------

Co-authored-by: Phillip LeBlanc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants