You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by am...@apache.org on 2022/05/12 10:01:51 UTC
[arrow] branch master updated: ARROW-16468: [Python] Test Table filter feature with complex exprs and add Expression.apply method
This is an automated email from the ASF dual-hosted git repository.
amolina pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new fce426a51f ARROW-16468: [Python] Test Table filter feature with complex exprs and add Expression.apply method
fce426a51f is described below
commit fce426a51fb91a7da7a21ff2b2c32f0456d7f84a
Author: Alessandro Molina <am...@turbogears.org>
AuthorDate: Thu May 12 12:01:41 2022 +0200
ARROW-16468: [Python] Test Table filter feature with complex exprs and add Expression.apply method
Depends on https://github.com/apache/arrow/pull/13075
Closes #13099 from amol-/ARROW-16468
Authored-by: Alessandro Molina <am...@turbogears.org>
Signed-off-by: Alessandro Molina <am...@turbogears.org>
---
python/pyarrow/tests/test_exec_plan.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/python/pyarrow/tests/test_exec_plan.py b/python/pyarrow/tests/test_exec_plan.py
index dd6ca9eec2..f93aac3f86 100644
--- a/python/pyarrow/tests/test_exec_plan.py
+++ b/python/pyarrow/tests/test_exec_plan.py
@@ -255,3 +255,20 @@ def test_filter_table_ordering():
# which is still a signal that the order is not preserved.
r = ep._filter_table(table, pc.field('a') == 1)
assert r["b"] == pa.chunked_array([["a"], ["b"]])
+
+
+def test_complex_filter_table():
+ t = pa.table({
+ "a": [1, 2, 3, 4, 5, 6, 6],
+ "b": [10, 20, 30, 40, 50, 60, 61]
+ })
+
+ result = ep._filter_table(
+ t, ((pc.bit_wise_and(pc.field("a"), pc.scalar(1)) == pc.scalar(0)) &
+ (pc.multiply(pc.field("a"), pc.scalar(10)) == pc.field("b")))
+ )
+
+ assert result == pa.table({
+ "a": [2, 4, 6], # second six must be omitted because 6*10 != 61
+ "b": [20, 40, 60]
+ })