MCPcopy Create free account
hub / github.com/apache/arrow / test_udf_via_substrait

Function test_udf_via_substrait

python/pyarrow/tests/test_substrait.py:327–447  ·  view source on GitHub ↗
(unary_func_fixture, use_threads)

Source from the content-addressed store, hash-verified

325
326@pytest.mark.parametrize("use_threads", [True, False])
327def test_udf_via_substrait(unary_func_fixture, use_threads):
328 test_table = pa.Table.from_pydict({"x": [1, 2, 3]})
329
330 def table_provider(names, _):
331 if not names:
332 raise Exception("No names provided")
333 elif names[0] == "t1":
334 return test_table
335 else:
336 raise Exception("Unrecognized table name")
337
338 substrait_query = b"""
339 {
340 "extensionUris": [
341 {
342 "extensionUriAnchor": 1
343 },
344 {
345 "extensionUriAnchor": 2,
346 "uri": "urn:arrow:substrait_simple_extension_function"
347 }
348 ],
349 "extensions": [
350 {
351 "extensionFunction": {
352 "extensionUriReference": 2,
353 "functionAnchor": 1,
354 "name": "y=x+1"
355 }
356 }
357 ],
358 "relations": [
359 {
360 "root": {
361 "input": {
362 "project": {
363 "common": {
364 "emit": {
365 "outputMapping": [
366 1,
367 2,
368 ]
369 }
370 },
371 "input": {
372 "read": {
373 "baseSchema": {
374 "names": [
375 "t",
376 ],
377 "struct": {
378 "types": [
379 {
380 "i64": {
381 "nullability": "NULLABILITY_REQUIRED"
382 }
383 },
384 ],

Callers

nothing calls this directly

Calls 1

mock_udf_contextFunction · 0.70

Tested by

no test coverage detected