Skip to content

Commit c83fa81

Browse files
committed
Add unit test covering expressions in slice
1 parent c4b1e1b commit c83fa81

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

python/tests/test_functions.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,10 @@ def py_flatten(arr):
510510
lambda col: col[literal(1) : literal(4)],
511511
lambda data: [arr[1:4] for arr in data],
512512
),
513+
(
514+
lambda col: col[column("indices") : column("indices") + literal(2)],
515+
lambda data: [[2.0, 3.0], [], [6.0]],
516+
),
513517
(
514518
lambda col: col[literal(1) : literal(4) : literal(2)],
515519
lambda data: [arr[1:4:2] for arr in data],
@@ -554,8 +558,11 @@ def py_flatten(arr):
554558
)
555559
def test_array_functions(stmt, py_expr):
556560
data = [[1.0, 2.0, 3.0, 3.0], [4.0, 5.0, 3.0], [6.0]]
561+
indices = [1, 3, 0]
557562
ctx = SessionContext()
558-
batch = pa.RecordBatch.from_arrays([np.array(data, dtype=object)], names=["arr"])
563+
batch = pa.RecordBatch.from_arrays(
564+
[np.array(data, dtype=object), indices], names=["arr", "indices"]
565+
)
559566
df = ctx.create_dataframe([[batch]])
560567

561568
col = column("arr")

0 commit comments

Comments
 (0)