amol- commented on code in PR #13075:
URL: https://github.com/apache/arrow/pull/13075#discussion_r870030999


##########
python/pyarrow/tests/test_exec_plan.py:
##########
@@ -190,3 +191,35 @@ def test_table_join_keys_order():
         "colVals_l": ["a", "b", "f", None],
         "colVals_r": ["A", "B", None, "Z"],
     })
+
+
+@pytest.mark.parametrize("use_datasets", [False, True])
+def test_filter_table(use_datasets):
+    t = pa.table({
+        "a": [1, 2, 3, 4, 5],
+        "b": [10, 20, 30, 40, 50]
+    })
+    if use_datasets:
+        t = ds.dataset([t])
+
+    result = ep._filter_table(
+        t, (pc.field("a") <= pc.scalar(3)) & (pc.field("b") == pc.scalar(20)),
+        output_type=pa.Table if not use_datasets else ds.InMemoryDataset
+    )
+    if use_datasets:
+        result = result.to_table()
+    assert result == pa.table({
+        "a": [2],
+        "b": [20]
+    })
+
+    result = ep._filter_table(
+        t, pc.field("b") > pc.scalar(30),
+        output_type=pa.Table if not use_datasets else ds.InMemoryDataset
+    )
+    if use_datasets:
+        result = result.to_table()
+    assert result == pa.table({
+        "a": [4, 5],
+        "b": [40, 50]
+    })

Review Comment:
   👍 done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to