You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "westonpace (via GitHub)" <gi...@apache.org> on 2023/01/26 13:28:24 UTC
[GitHub] [arrow] westonpace opened a new issue, #33883: [Python] Adopt a more pythonic method for UDF registration
westonpace opened a new issue, #33883:
URL: https://github.com/apache/arrow/issues/33883
### Describe the enhancement requested
It's currently quite complicated to register a UDF. In a recent PR we reviewed a few different suggestions. We should adopt one of these.
### Component(s)
Python
--
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: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] westonpace commented on issue #33883: [Python] Adopt a more pythonic method for UDF registration
Posted by "westonpace (via GitHub)" <gi...@apache.org>.
westonpace commented on issue #33883:
URL: https://github.com/apache/arrow/issues/33883#issuecomment-1405009345
I think [this suggestion](https://github.com/apache/arrow/pull/14320#issuecomment-1372473478), from @pitrou , is rather compelling:
```
udf = pc.register_scalar_function(
name="y=x*2",
arg_names=["x"],
doc = {"summary": "multiply by two function",
"description": "test multiply function"}
)
for in_type in [pa.int64(), pa.float64()]:
udf.add_kernel([in_type], in_type, impl)
udf = pc.register_scalar_function(
name="y=x*2",
arg_names=["x"],
doc = {"summary": "multiply by two function",
"description": "test multiply function"}
)
@udf.kernel([pa.float64()], pa.float64())
@udf.kernel([pa.int64()], pa.int64())
def impl(ctx, x):
# ...
```
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org