comphead opened a new issue, #4545:
URL: https://github.com/apache/arrow-rs/issues/4545
**Describe the bug**
<!--
A clear and concise description of what the bug is.
-->
Arrow ordering use unstable sort which doesn't guarantee sort order between
same elements, this causing undesired behavior for systems that expects stable
sort
**To Reproduce**
<!--
Steps to reproduce the behavior:
-->
```
#[test]
fn test_sort_primitives2() {
let n = 20;
let mut arr: [(u32, i32); 20] = [(0, 0); 20];
(0 .. n).map(|d| Some(d % 2)).enumerate().for_each(|v| arr[v.0] =
(v.0.try_into().unwrap(), v.1.unwrap()));
//println!("{:?}", arr);
sort_unstable_by::<(u32, i32), _>(&mut arr, n as usize, |a, b|
cmp(a.1, b.1).reverse());
println!("{:?}", arr.iter().filter(|v| v.1 == 1).map(|v|
v.0).collect::<Vec<_>>());
}
```
The test outputs array indices for 1 and this is correct, in sync with input
data
```
[1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
```
For n = 21 which shouldn't change the output, but instead indices are messed
```
[15, 1, 3, 5, 7, 9, 11, 13, 17, 19]
```
**Expected behavior**
<!--
A clear and concise description of what you expected to happen.
-->
**Additional context**
<!--
Add any other context about the problem here.
-->
Related to https://github.com/apache/arrow-rs/issues/2871
--
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]