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

Function test_serializing_udfs

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

Source from the content-addressed store, hash-verified

1071
1072
1073def test_serializing_udfs():
1074 # Note, UDF in this context means a function that is not
1075 # recognized by Substrait. It might still be a builtin pyarrow
1076 # function.
1077 schema = pa.schema([
1078 pa.field("x", pa.uint32())
1079 ])
1080 a = pc.scalar(10)
1081 b = pc.scalar(4)
1082 exprs = [pc.shift_left(a, b)]
1083
1084 with pytest.raises(ArrowNotImplementedError):
1085 pa.substrait.serialize_expressions(exprs, ["expr"], schema)
1086
1087 buf = pa.substrait.serialize_expressions(
1088 exprs, ["expr"], schema, allow_arrow_extensions=True)
1089 returned = pa.substrait.deserialize_expressions(buf)
1090 assert schema == returned.schema
1091 assert len(returned.expressions) == 1
1092 assert str(returned.expressions["expr"]) == str(exprs[0])
1093
1094
1095def 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