MCPcopy
hub / github.com/ray-project/ray / test_pyarrow

Function test_pyarrow

python/ray/data/tests/test_transform_pyarrow.py:34–48  ·  view source on GitHub ↗
(ray_start_regular_shared)

Source from the content-addressed store, hash-verified

32
33
34def test_pyarrow(ray_start_regular_shared):
35 ds = ray.data.range(5)
36 assert ds.map(lambda x: {"b": x["id"] + 2}).take() == [
37 {"b": 2},
38 {"b": 3},
39 {"b": 4},
40 {"b": 5},
41 {"b": 6},
42 ]
43 assert ds.map(lambda x: {"b": x["id"] + 2}).filter(
44 lambda x: x["b"] % 2 == 0
45 ).take() == [{"b": 2}, {"b": 4}, {"b": 6}]
46 assert ds.filter(lambda x: x["id"] == 0).flat_map(
47 lambda x: [{"b": x["id"] + 2}, {"b": x["id"] + 20}]
48 ).take() == [{"b": 2}, {"b": 20}]
49
50
51def _create_dataset(op, data):

Callers

nothing calls this directly

Calls 4

flat_mapMethod · 0.80
takeMethod · 0.45
mapMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…