Uh oh!
There was an error while loading. Please reload this page.
Add plugable handler for CREATE FUNCTION - #9333
Conversation
CREATE FUNCTIONmilenkovicm
commented
Feb 24, 2024
Drop function will be added as well |
alamb
commented
Feb 28, 2024
Hi @milenkovicm -- I plan to review this PR shortly |
alamb
left a comment
There was a problem hiding this comment.
Thank you for this PR @milenkovicm -- I think the idea and the PR is really neat and the code was easy to follow. ❤️
I left some API suggestions, and comments in regards to your questions. Let me know what you think.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| ctx.sql_with_options(sql, options).await.unwrap(); | ||
| } | ||
| struct MockFunctionFactory; |
There was a problem hiding this comment.
This is very cool -- I think it would be great (as a follow on PR) if we turned this into an example (with docs, etc like the others in https://github.com/apache/arrow-datafusion/tree/main/datafusion-examples/examples)
There was a problem hiding this comment.
Right, this functionality looks important and definitely needs to be covered with docs, examples in following PR, looking forward for it
Uh oh!
There was an error while loading. Please reload this page.
milenkovicm
commented
Feb 29, 2024
Comments totally make sense thanks @alamb, |
Items to follow up (new issues or discussion)
|
b9bf00e to
acdb4b5CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
alamb
left a comment
There was a problem hiding this comment.
Looking very 👨🍳 👌 nice @milenkovicm
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
25206aa to
45c7edbCompareUh oh!
There was an error while loading. Please reload this page.
0b93b6a to
a1d75a5Compare
alamb
left a comment
There was a problem hiding this comment.
Thank you @milenkovicm -- I think this PR is almost good to go from my perspective. I had a few minor comments, but nothing major.
I think we should have at least one other maintainer give it a look. Perhaps @comphead or @universalmind303 ?
One interesting implication of this feature is that once we migrate all functions to be "udfs" (e.g. #8045) it means we can now drop functions that weren't explicitly made with CREATE FUNCTION
For example, on this branch I can drop the abs function:
DataFusion CLI v36.0.0
❯ DROP FUNCTION abs;
0 rows inset. Query took 0.009 seconds.Although I do get an appropriate error when I try to drop a function that is still a BuiltInScalarFunction like add:
❯ DROP FUNCTION add;
Execution error: Function does not existPeople could
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
alamb
left a comment
There was a problem hiding this comment.
Thanks again @milenkovicm -- the only thing left from my perspective is to "error on multi-part identifiers" which I think we could do as a follow on PR if needed.
However, I do think we should leave this open for a few more days to let other people have a chance to comment on it before we merge.
Thanks again. This is a really neat feature that I think will let people build all sorts of cool things using DataFusion 🙏
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
milenkovicm
commented
Mar 2, 2024
@alamb multi-part identifiers fixed as well, please have a look. also, can you please let me know once new version of thanks a lot for all your help |
milenkovicm
commented
Mar 2, 2024
and please squash commit on merge, thanks |
alamb
commented
Mar 2, 2024
Yes, this will be done (as on all commits) |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
comphead
left a comment
There was a problem hiding this comment.
Thanks @milenkovicm
I would say it is nice to get also tests what will happen if the function is invalid/not compilable or something
another question if function can call another function?
milenkovicm
commented
Mar 2, 2024
Thanks for your comments @comphead , |
comphead
commented
Mar 2, 2024
Its great to have a test with invalid function, the function which is not parseable or compilable. And the next question if the user created functions |
... `DROP FUNCTION` will look for function name in all available registries (udf, udaf, udwf). `remove` may be necessary if UDaF and UDwF do not get `simplify` method from apache#9304.
FunctionDefinition already exists, DefinitionStatement makes more sense.
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
…ns.rs Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
f17a50f to
383602cCompare... as `create function` gets support in latest sqlparser.
I merged up from main to pick up a fix for the CI (I hope 🤞 ) |
milenkovicm
commented
Mar 5, 2024
Thanks @alamb |
alamb
commented
Mar 5, 2024
Merged up from main again to resolve conflicts |
alamb
commented
Mar 5, 2024
Thanks again @milenkovicm -- this is a pretty epic feature |
Which issue does this PR close?
Closes#9332.
Rationale for this change
explained in #9332
What changes are included in this PR?
this is minimum viable product, with some open question which i hope to resolve in the process of PR review (note TODOs)
Are these changes tested?
There is a test in place but would add more if community aggress to accept the change.
Usage example can be found at https://github.com/milenkovicm/torchfusion
Are there any user-facing changes?
There are using facing changes, but they are backward compatible. Would update docs if community aggress to accept the change.
A problem I see is from perspective of user experience, as generic parser does not support
CREATE FUNCTIONstatement, user should change parser configuration toPostgreSQL. Maybe it would make sense after this change is merged addingCREATE FUNCTIONto generic flavour