-
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
Implement SHOW FUNCTIONS
#13799
Implement SHOW FUNCTIONS
#13799
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.
This looks awesome @goldmedal . Thank you.
One thing I noticed is that including all the information in the output results in a pretty wide output schema
However, I don't really have any good suggestion to avoid this
@@ -1222,6 +1237,12 @@ impl InformationSchemaParameters { | |||
Field::new("data_type", DataType::Utf8, false), | |||
Field::new("parameter_default", DataType::Utf8, true), | |||
Field::new("is_variadic", DataType::Boolean, false), | |||
// `rid` (short for `routine id`) is used to differentiate parameters from different signatures |
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.
💯 for the documentation
Thanks, @alamb for the review. Indeed, I think there are two directions for improvement:
About showing the wide column, our behavior is similar to Postgres
However, the way DuckDB did is more readable.
About the second issue, I have no idea how to improve it 🤔. It's an limit of
or
Maybe we can consider improving the UX of the CLI. |
Thanks @goldmedal it would be really nice to update the user documentation |
That is an excellent idea -- I think it is one of @matthewmturner 's goals with https://github.com/datafusion-contrib/datafusion-dft I am not sure how complicated we should make datafusion-cli -- there is a tension between a great CLI experience and keeping the code focused and maintainable |
In #13868 |
Thank you @goldmedal and @comphead -- very nice |
Indeed, I am looking to incorporate something to improve the experience of looking at function help in dft. I have some ideas but haven't gotten around to it yet |
Which issue does this PR close?
Closes #12144.
Rationale for this change
This PR implements
SHOW FUNCTIONS
to list the available functions during runtime. Instead of listing the function name only (like Apache Spark), I think it's better to provide more information like what Snowflake did.To provide the required information, I also added some columns to
information_schema.routines
andinformation_schema.parameters
.Syntax
Sample Output
The Output Schema
function_name
return_type
parameters
: The name of parameters (ordered by the ordinal position)parameter_types
: The type of parameters (ordered by the ordinal position)description
: The description of the function (the description defined in the document)syntax_example
: The syntax_example of the function (the syntax_example defined in the document)What changes are included in this PR?
SHOW FUNCTIONS
.syntax_example
field toinformation_schema.routines
.rid
field toinformation_schema.parameters
.rid
(short forroutine id
) is used to differentiate parameters from different signatures (it serves as the group-by key when generating theSHOW FUNCTIONS
query). For example, the following signatures have differentrid
values:datetrunc(Utf8, Timestamp(Microsecond, Some("+TZ"))) -> Timestamp(Microsecond, Some("+TZ"))
datetrunc(Utf8View, Timestamp(Nanosecond, None)) -> Timestamp(Nanosecond, None)
Are these changes tested?
yes, tested by sqllogictests
Are there any user-facing changes?
New SQL syntax.