jorisvandenbossche commented on code in PR #36162:
URL: https://github.com/apache/arrow/pull/36162#discussion_r1252643646
##########
python/pyarrow/tests/test_convert_builtin.py:
##########
@@ -2457,14 +2457,29 @@ def test_array_from_pylist_offset_overflow():
)
])
def test_array_accepts_pyarrow_scalar(seq, data, scalar_data, value_type):
- if type(seq(scalar_data)) == set:
- pytest.skip("TODO: The elements in the set get reordered.")
expect = pa.array(data, type=value_type)
result = pa.array(seq(scalar_data))
- assert expect.equals(result)
+
+ if type(seq(scalar_data)) == set:
+ try:
+ import pyarrow.compute as pc
+ expect = [expect[a] for a in
pc.array_sort_indices(expect).to_pylist()]
+ result = [result[a] for a in
pc.array_sort_indices(result).to_pylist()]
+ expect == result
+ except pa.lib.ArrowNotImplementedError:
+ set(expect) == set(result)
Review Comment:
Hmm. Sorry for the back and forth here, but then I would maybe go back to
the initial skip (with an updated comment). I don't think this is worth the
complexity. We know that sets can be iterated multiple times (just with an
non-deterministic order), and won't give a problem here, accept being difficult
to test with general data.
(eg, while testing some other options, I also noticed that for the case of
null type, for a set it actually created a different array because of
de-duplicating the sequence)
--
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]