Skip to content

Commit 06b693d

Browse files
authored
GH-46174: [Python] Failing tests in python minimal builds (#46175)
### Rationale for this change There are tests failing in builds: https://github.com/ursacomputing/crossbow/actions/runs/14504182772/job/40690374094#step:3:15238 https://github.com/ursacomputing/crossbow/actions/runs/14504182883/job/40690374677#step:3:13330 ### What changes are included in this PR? Tests that caused the failure are moved from `test_compute.py` to `test_acero.py.` ### Are these changes tested? Yes. ### Are there any user-facing changes? No, only changes in the tests. * GitHub Issue: #46174 Authored-by: AlenkaF <[email protected]> Signed-off-by: Raúl Cumplido <[email protected]>
1 parent 831b5f0 commit 06b693d

2 files changed

Lines changed: 19 additions & 22 deletions

File tree

‎python/pyarrow/tests/test_acero.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,25 @@ def test_filter(table_source):
115115
FilterNodeOptions(None)
116116

117117

118+
@pytest.mark.parametrize('source', [
119+
pa.record_batch({"number": [1, 2, 3]}),
120+
pa.table({"number": [1, 2, 3]})
121+
])
122+
def test_filter_all_rows(source):
123+
# GH-46057: filtering all rows should return empty RecordBatch with same schema
124+
result_expr = source.filter(pc.field("number") < 0)
125+
126+
assert result_expr.num_rows == 0
127+
assert type(result_expr) is type(source)
128+
assert result_expr.schema.equals(source.schema)
129+
130+
result_mask = source.filter(pa.array([False, False, False]))
131+
132+
assert result_mask.num_rows == 0
133+
assert type(result_mask) is type(source)
134+
assert result_mask.schema.equals(source.schema)
135+
136+
118137
def test_project(table_source):
119138
# default name from expression
120139
decl = Declaration.from_sequence([

‎python/pyarrow/tests/test_compute.py‎

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,17 +1415,6 @@ def test_filter_record_batch():
14151415
expected = pa.record_batch([pa.array(["a", None, "e"])], names=["a'"])
14161416
assert result.equals(expected)
14171417

1418-
# GH-46057: filtering all rows should return empty RecordBatch with same schema
1419-
mask_empty_result = batch.filter(pa.array([False] * batch.num_rows))
1420-
assert mask_empty_result.num_rows == 0
1421-
assert isinstance(mask_empty_result, pa.RecordBatch)
1422-
assert mask_empty_result.schema.equals(batch.schema)
1423-
1424-
expr_empty_result = batch.filter(pc.field("a'") == "zzz")
1425-
assert expr_empty_result.num_rows == 0
1426-
assert isinstance(expr_empty_result, pa.RecordBatch)
1427-
assert expr_empty_result.schema.equals(batch.schema)
1428-
14291418

14301419
def test_filter_table():
14311420
table = pa.table([pa.array(["a", None, "c", "d", "e"])], names=["a"])
@@ -1445,17 +1434,6 @@ def test_filter_table():
14451434
result = table.filter(mask, null_selection_behavior="emit_null")
14461435
assert result.equals(expected_null)
14471436

1448-
# GH-46057: filtering all rows should return empty table with same schema
1449-
mask_empty_result = table.filter(pa.array([False] * table.num_rows))
1450-
assert mask_empty_result.num_rows == 0
1451-
assert isinstance(mask_empty_result, pa.Table)
1452-
assert mask_empty_result.schema.equals(table.schema)
1453-
1454-
expr_empty_result = table.filter(pc.field("a") == "zzz")
1455-
assert expr_empty_result.num_rows == 0
1456-
assert isinstance(expr_empty_result, pa.Table)
1457-
assert expr_empty_result.schema.equals(table.schema)
1458-
14591437

14601438
def test_filter_errors():
14611439
arr = pa.chunked_array([["a", None], ["c", "d", "e"]])

0 commit comments

Comments
 (0)