Register a unary scalar function.
()
| 308 | # Define udf fixture for test_udf.py and test_substrait.py |
| 309 | @pytest.fixture(scope="session") |
| 310 | def unary_func_fixture(): |
| 311 | """ |
| 312 | Register a unary scalar function. |
| 313 | """ |
| 314 | from pyarrow import compute as pc |
| 315 | |
| 316 | def unary_function(ctx, x): |
| 317 | return pc.call_function("add", [x, 1], |
| 318 | memory_pool=ctx.memory_pool) |
| 319 | func_name = "y=x+1" |
| 320 | unary_doc = {"summary": "add function", |
| 321 | "description": "test add function"} |
| 322 | pc.register_scalar_function(unary_function, |
| 323 | func_name, |
| 324 | unary_doc, |
| 325 | {"array": pa.int64()}, |
| 326 | pa.int64()) |
| 327 | return unary_function, func_name |
| 328 | |
| 329 | |
| 330 | @pytest.fixture(scope="session") |
nothing calls this directly
no outgoing calls
no test coverage detected