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

Function test_expression_arithmetic_operators

python/pyarrow/tests/test_dataset.py:919–933  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

917
918
919def test_expression_arithmetic_operators():
920 dataset = ds.dataset(pa.table({'a': [1, 2, 3], 'b': [2, 2, 2]}))
921 a = ds.field("a")
922 b = ds.field("b")
923 result = dataset.to_table(columns={
924 "a+1": a + 1,
925 "b-a": b - a,
926 "a*2": a * 2,
927 "a/b": a.cast("float64") / b,
928 })
929 expected = pa.table({
930 "a+1": [2, 3, 4], "b-a": [1, 0, -1],
931 "a*2": [2, 4, 6], "a/b": [0.5, 1.0, 1.5],
932 })
933 assert result.equals(expected)
934
935
936def test_partition_keys():

Callers

nothing calls this directly

Calls 4

equalsMethod · 0.80
fieldMethod · 0.45
to_tableMethod · 0.45
castMethod · 0.45

Tested by

no test coverage detected