-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Show column names instead of indices in query plans #2690
Show column names instead of indices in query plans #2690
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 More readable!
.iter() | ||
.map(|i| schema.field(*i).name().as_str()) | ||
.collect(); | ||
format!("Some([{}])", names.join(", ")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about only showing the projection when there is one and ommiting it when there are none.
This could remove the None/Some too:
TableScan a projection=[col1,col2]
vs
TableScan a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started out doing that and it broke many tests that were expecting None
so I decided to reduce the size of the change. I agree that it would be a nice improvement though. I'm happy to work on that as a follow-on PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed #2697
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is a nice improvement -- @Dandandan 's suggestion would make it even more so (though I think it can be done as a follow on PR as well). Thanks @andygrove
Which issue does this PR close?
Closes #2689
Rationale for this change
I am comparing query plans between Spark and DataFusion
Spark shows:
DataFusion shows:
I think we should show column names rather than numeric indices so that users don't have to memorize the schemas of the tables in order to comprehend the query plan.
What changes are included in this PR?
Show names instead of indices.
Are there any user-facing changes?
Yes, plans are easier to understand.