feat: add user defined table function support#1113
Merged
timsaucer merged 13 commits intoapache:mainfrom May 18, 2025
Merged
Conversation
This was referenced Apr 26, 2025
2b7de60 to
a55969c
Compare
Member
Author
|
@mesejo @kosiew @chenkovsky @kevinjqliu Would any of you mind doing a review? We haven't released datafusion-python in a while and this is one of the PRs waiting to go in. 2/3 |
kosiew
reviewed
May 16, 2025
Contributor
kosiew
left a comment
There was a problem hiding this comment.
Overall, this looks good to me.
I left a minor comment and one more regarding a missing _create_table_udf_decorator function.
Comment on lines
27
to
29
| arrow = { version = "55" } | ||
| arrow-array = { version = "55" } | ||
| arrow-schema = { version = "55" } |
Contributor
There was a problem hiding this comment.
You’ve pinned arrow = { version = "55" }, but other examples use arrow = { version = "55.0.0" }?
Should it be 55.*?
python/datafusion/udf.py
Outdated
| if args and hasattr(args[0], "__datafusion_table_function__"): | ||
| return TableFunction(args[1], args[0]) | ||
| # Case 2: Used as a decorator with parameters | ||
| return TableFunction._create_table_udf_decorator(*args, **kwargs) |
Contributor
There was a problem hiding this comment.
I could not find _create_table_udf_decorator in TableFunction
andygrove
approved these changes
May 17, 2025
…er more examples than just table providers
…er and table function
5f324a5 to
7d92a6a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
This addresses part of #1017
Rationale for this change
This feature exposes the ability to create user defined functions. Support exists in the upstream
datafusionrepository but was not exposed in the Python bindings.What changes are included in this PR?
This adds a new
udtffunction and associated classes for creating user defined table functions. With this change you can either provide a pure python or a rust backed udtf.There are new unit tests provided with this PR and an example usage.
Are there any user-facing changes?
This is a pure addition.