AlenkaF commented on code in PR #36162:
URL: https://github.com/apache/arrow/pull/36162#discussion_r1251884730
##########
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:
That was my first try, but in the case of dictionary type the set mixed the
elements differently 🤷♀️
But `sorted(expect.to_pylist()) == sorted(result.to_pylist())` is a great
idea! Tried without the `to_pylist` but it ofcourse didn't work. Will update
today 👍
--
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]