You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "findepi (via GitHub)" <gi...@apache.org> on 2024/08/30 16:41:18 UTC

[PR] Implement SHOW FUNCTIONS [datafusion]

findepi opened a new pull request, #12266:
URL: https://github.com/apache/datafusion/pull/12266

   ## Which issue does this PR close?
   
   Closes https://github.com/apache/datafusion/issues/12144
   
   ## Rationale for this change
   
   see https://github.com/apache/datafusion/issues/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 https://github.com/sqlparser-rs/sqlparser-rs/issues/1399
   
   ## Are these changes tested?
   
   Yes
   
   ## Are there any user-facing changes?
   
   Support for the SHOW FUNCTIONS statement.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Implement SHOW FUNCTIONS [datafusion]

Posted by "findepi (via GitHub)" <gi...@apache.org>.
findepi commented on code in PR #12266:
URL: https://github.com/apache/datafusion/pull/12266#discussion_r1741872728


##########
datafusion/sql/src/statement.rs:
##########
@@ -1588,6 +1592,37 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
         self.statement_to_plan(rewrite.pop_front().unwrap()) // length of rewrite is 1
     }
 
+    fn show_functions_to_plan(
+        &self,
+        filter: Option<ShowStatementFilter>,
+    ) -> Result<LogicalPlan> {
+        if filter.is_some() {

Review Comment:
   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 https://github.com/sqlparser-rs/sqlparser-rs/issues/1399
   it would be best to resolve this (either fix or close the issue) before jumping on the filtering support



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Implement SHOW FUNCTIONS [datafusion]

Posted by "matthewmturner (via GitHub)" <gi...@apache.org>.
matthewmturner commented on PR #12266:
URL: https://github.com/apache/datafusion/pull/12266#issuecomment-2353747651

   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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Implement SHOW FUNCTIONS [datafusion]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #12266:
URL: https://github.com/apache/datafusion/pull/12266#issuecomment-2506952118

   Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Implement SHOW FUNCTIONS [datafusion]

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #12266:
URL: https://github.com/apache/datafusion/pull/12266#discussion_r1739921615


##########
datafusion/sql/src/statement.rs:
##########
@@ -1588,6 +1592,37 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
         self.statement_to_plan(rewrite.pop_front().unwrap()) // length of rewrite is 1
     }
 
+    fn show_functions_to_plan(
+        &self,
+        filter: Option<ShowStatementFilter>,
+    ) -> Result<LogicalPlan> {
+        if filter.is_some() {

Review Comment:
   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



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Implement SHOW FUNCTIONS [datafusion]

Posted by "findepi (via GitHub)" <gi...@apache.org>.
findepi commented on PR #12266:
URL: https://github.com/apache/datafusion/pull/12266#issuecomment-2548250364

   superseded by @goldmedal 's https://github.com/apache/datafusion/pull/13799 
   thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Implement SHOW FUNCTIONS [datafusion]

Posted by "findepi (via GitHub)" <gi...@apache.org>.
findepi commented on PR #12266:
URL: https://github.com/apache/datafusion/pull/12266#issuecomment-2326254498

   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 https://github.com/apache/datafusion/issues/12144


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Implement SHOW FUNCTIONS [datafusion]

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #12266:
URL: https://github.com/apache/datafusion/pull/12266#discussion_r1739422785


##########
datafusion/core/tests/sql/show.rs:
##########
@@ -0,0 +1,45 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use super::*;
+use std::collections::HashSet;
+
+#[tokio::test]
+async fn test_show_functions() {
+    let ctx = SessionContext::new();
+    let result = execute(&ctx, "SHOW FUNCTIONS").await;
+    println!("{:?}", result);

Review Comment:
   ```suggestion
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Implement SHOW FUNCTIONS [datafusion]

Posted by "matthewmturner (via GitHub)" <gi...@apache.org>.
matthewmturner commented on PR #12266:
URL: https://github.com/apache/datafusion/pull/12266#issuecomment-2322379062

   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](https://github.com/datafusion-contrib/datafusion-tui).  This is certainly a step in that direction.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Implement SHOW FUNCTIONS [datafusion]

Posted by "findepi (via GitHub)" <gi...@apache.org>.
findepi closed pull request #12266: Implement SHOW FUNCTIONS
URL: https://github.com/apache/datafusion/pull/12266


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org