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

Function test_serializing_udfs

python/pyarrow/tests/test_substrait.py:1060–1079  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1058
1059
1060def test_serializing_udfs():
1061 # Note, UDF in this context means a function that is not
1062 # recognized by Substrait. It might still be a builtin pyarrow
1063 # function.
1064 schema = pa.schema([
1065 pa.field("x", pa.uint32())
1066 ])
1067 a = pc.scalar(10)
1068 b = pc.scalar(4)
1069 exprs = [pc.shift_left(a, b)]
1070
1071 with pytest.raises(ArrowNotImplementedError):
1072 pa.substrait.serialize_expressions(exprs, ["expr"], schema)
1073
1074 buf = pa.substrait.serialize_expressions(
1075 exprs, ["expr"], schema, allow_arrow_extensions=True)
1076 returned = pa.substrait.deserialize_expressions(buf)
1077 assert schema == returned.schema
1078 assert len(returned.expressions) == 1
1079 assert str(returned.expressions["expr"]) == str(exprs[0])
1080
1081
1082def test_serializing_schema():

Callers

nothing calls this directly

Calls 4

lenFunction · 0.85
schemaMethod · 0.45
fieldMethod · 0.45
scalarMethod · 0.45

Tested by

no test coverage detected