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

Implement SHOW FUNCTIONS #12266

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

findepi
Copy link
Member

@findepi findepi commented Aug 30, 2024

Which issue does this PR close?

Closes #12144

Rationale for this change

see #12144

I as a user would want to see a list of available functions

What changes are included in this PR?

Support for Statement::ShowFunctions by converting it directly to VALUES.
Filters are not supported. The syntax for filters is subject to apache/datafusion-sqlparser-rs#1399

Are these changes tested?

Yes

Are there any user-facing changes?

Support for the SHOW FUNCTIONS statement.

@github-actions github-actions bot added sql SQL Planner core Core DataFusion crate labels Aug 30, 2024
Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats a real nice initiative.
I would like to add tests to information_schema.slt like show function
Also we need to expose it to user documentation

@matthewmturner
Copy link
Contributor

It would be really nice if this could somehow include function documentation / signature. ive been wondering how i could get functions and their documentation into datafusion-tui. This is certainly a step in that direction.

Co-authored-by: Oleks V <comphead@users.noreply.github.com>
&self,
filter: Option<ShowStatementFilter>,
) -> Result<LogicalPlan> {
if filter.is_some() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we planning to apply the filter in future?

For example for SHOW now it is possible to display specific parameter like

show datafusion.execution.batch_size

I think it would be interesting to show the function by filter so ther user can get the name and ideally the signature.

Later we can use this metadata table to obtain correct signature in unified way instead of hardcoding signatures like now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is a good idea.
however, i think sqlparser-rs has the syntax potentialy mixed up.
the filter syntax is borrowed from MySQL while the statement itself isn't borrowed from there, creating a unique mix. see apache/datafusion-sqlparser-rs#1399
it would be best to resolve this (either fix or close the issue) before jumping on the filtering support

@findepi findepi marked this pull request as draft September 3, 2024 11:10
@findepi
Copy link
Member Author

findepi commented Sep 3, 2024

Thank you for the feedback!

In the related issue there is a discussion whether we want SHOW FUNCTIONS syntax at all.
For the time being, I am putting this PR into draft mode to reflect that we first need to have a decision whether and what we want here.

see #12144

@matthewmturner
Copy link
Contributor

Im not sure the implementation details that get descriptions / signatures to flow through here (so maybe this is already handled) but I think it would be cool if functions registered through function registries also had a way to include their relevant details.

For example, we recently added datafusion-functions-json to dft and once this PR is merged I plan on adding a help feature / tab. It would be very nice if both out of the box and third party functions were included in that help.

@Omega359
Copy link
Contributor

It would be really nice if this could somehow include function documentation / signature. ive been wondering how i could get functions and their documentation into datafusion-tui. This is certainly a step in that direction.

See #12432

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

List available functions (SHOW FUNCTIONS)
4 participants