refactor(bigframes): Simplify @udf wrapper object#16556
refactor(bigframes): Simplify @udf wrapper object#16556TrevorBergeron wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the User Defined Function (UDF) infrastructure by introducing a Udf protocol and a UdfRoutine dataclass, effectively consolidating the handling of BigQuery routines and removing the BigqueryCallableRowRoutine class. Code throughout the library now utilizes isinstance(..., Udf) for type checking. Furthermore, the system tests for managed functions have been significantly updated to use a pytest fixture for more reliable resource cleanup. Feedback was provided regarding the incorrect use of @functools.partial as a decorator on the UdfRoutine.__call__ method, which should be removed.
| # And this ref will be replaced with requirements rather to support lazy creation | ||
| _udf_def: udf_def.BigqueryUdf | ||
|
|
||
| @functools.partial |
There was a problem hiding this comment.
The @functools.partial decorator on the __call__ method of UdfRoutine appears to be incorrectly applied. functools.partial is typically used to create a new callable with some arguments pre-filled, not as a decorator for a method definition. In this context, it is likely either a no-op or could lead to unexpected behavior. Since the __call__ method simply delegates to self.func, this decorator seems redundant and could be removed for clarity.
| @functools.partial | |
| def __call__(self, *args, **kwargs): |
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕