lidavidm commented on PR #12590:
URL: https://github.com/apache/arrow/pull/12590#issuecomment-1090360573
Maybe this isn't a discussion for here but I would love to eventually be
able to do something like this:
```python
import pyarrow as pa
import pyarrow.compute as pc
@pc.udf
def my_udf(ints: pa.array[pa.int32]) -> pa.int32:
"""UDF summary.
UDF description.
"""
pass # ...
@my_udf.register
def my_udf(ints: pa.scalar[pa.int32]) -> pa.int32:
pass # ...
@pc.udf
def my_varargs_udf(required: pa.int32, *rest: List[pa.int32]) -> pa.int64:
# no annotation -> function can handle either array or scalar
pass # ...
@pc.udf
def my_other_udf(ints: pa.array[pa.int32]) -> pa.int32:
# no scalar case registered -> UDF framework will expand scalars into
arrays
pass # ...
```
though, figuring out how to handle things like being generic over types and
such will require more thought (and it will be hard to dynamically register
UDFs like this! though we could require calling `my_udf.register()` or
something)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]