-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Implement DESCRIBE SELECT to show schema rather than EXPLAIN plan
#18238
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
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.
Amazing! Could you just add some tests for both the working case and the error case? Maybe also with something slightly more interesting than SELECT 1;
For sure. Is the |
Yes I just don't know when that would be hit, it would be good to have an example of when that code path gets hit for future reference. |
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.
Thank you @djanderson and @adriangb
Since this is a behavior change I think, we probably need to
- Add a note in the upgrade guide
- Add some test coverage (.slt style)
1. simple describe select 1 2. a more complex query against table data 3. ensure that describing a non-query statement errors
|
Thank you for adding tests! I think the only thing missing is an entry in https://github.com/apache/datafusion/blob/main/docs/source/library-user-guide/upgrading.md |
|
@adriangb , done! But, as I was double checking currently documented behavior, I came upon https://datafusion.apache.org/user-guide/sql/ddl.html#describe, and I wasn't quite sure if a quick example about |
|
I would suggest to use a tree schema representation which was added recently #17459 because it supports nested types, outputting plain table for nested types like in this PR might be confusing |
Also better follow the "<feature> not supported" not_impl_err message convention used in this file, and significantly improve readability of error by not debug printing the statement.
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.
This is great -- thank you @djanderson , @comphead and @adriangb
DESCRIBE SELECT to show schema rather than EXPLAIN plan
@comphead, If you have an idea of how you'd like this approached, feel free to drop some notes in an issue and assign me! I looked into it a bit last night and couldn't figure out how to trivially make that change. Would it require a new |
Which issue does this PR close?
DESCRIBE SELECT 1;work #18234.Rationale for this change
https://discord.com/channels/885562378132000778/1430237388474552380/1430618776751313018
What changes are included in this PR?
Are these changes tested?
No, looking for feedback on approach first... happy to add a test.Yes.
Are there any user-facing changes?
Yes, it changes to behavior of
DESCRIBE SELECTfrom explaining the physical plan (EXPLAIN) to describing the schema of the query (like DESCRIBE table).