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

Function test_take_on_chunked_array

python/pyarrow/tests/test_compute.py:1507–1542  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1505
1506
1507def test_take_on_chunked_array():
1508 # ARROW-9504
1509 arr = pa.chunked_array([
1510 [
1511 "a",
1512 "b",
1513 "c",
1514 "d",
1515 "e"
1516 ],
1517 [
1518 "f",
1519 "g",
1520 "h",
1521 "i",
1522 "j"
1523 ]
1524 ])
1525
1526 indices = pa.array([0, 5, 1, 6, 9, 2])
1527 result = arr.take(indices)
1528 expected = pa.chunked_array([["a", "f", "b", "g", "j", "c"]])
1529 assert result.equals(expected)
1530
1531 indices = pa.chunked_array([[1], [9, 2]])
1532 result = arr.take(indices)
1533 expected = pa.chunked_array([
1534 [
1535 "b"
1536 ],
1537 [
1538 "j",
1539 "c"
1540 ]
1541 ])
1542 assert result.equals(expected)
1543
1544
1545@pytest.mark.parametrize('ordered', [False, True])

Callers

nothing calls this directly

Calls 4

chunked_arrayMethod · 0.80
equalsMethod · 0.80
arrayMethod · 0.45
takeMethod · 0.45

Tested by

no test coverage detected