fenfeng9 commented on code in PR #50094:
URL: https://github.com/apache/arrow/pull/50094#discussion_r3355862056


##########
python/pyarrow/tests/test_table.py:
##########
@@ -2976,6 +2976,37 @@ def sorted_by_keys(d):
     }
 
 
[email protected]
+def test_group_by_sliced_any_all():
+    # GH-50043: hash_any/hash_all produce incorrect results on sliced boolean 
arrays
+    # Row 0 will be discarded by slice, should not affect aggregation
+    table = pa.table(
+        {
+            "g": [99, 10, 10],
+            "any_arg": [True, False, None],
+            "all_arg": [False, True, None],
+        }
+    )
+    sliced = table.slice(1)
+
+    # any(False, None) = False, all(True, None) = True
+    result = sliced.group_by("g", use_threads=False).aggregate(

Review Comment:
   Good point. `use_threads=False` is not necessary here. I initially followed 
the reproducer from the issue. 
   I've updated the test to cover both `use_threads=False` and 
`use_threads=True`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to