Sorted Indices errors on large lists containing both numbers and strings #5328
Labels
bug
An issue that needs to be fixed. Alternatively, a PR fixing an issue.
priority: low
Issues that are not harmful to the experience but are related to useful changes or additions.
up for debate
When the decision is yet to be debated on the issue in question
Skript/Server Version
Bug Description
When using
sorted indices
on large lists with both numbers and strings (roughly larger than 1000 or so elements) TimSort errors, complaining the comparator violated its general contract. This does not occur with smaller lists (eg: 100 elements) as I believe Stream#sorted doesn't use TimSort for shorter lists.I added a String, Number comparator and that fixed the issue, but I don't know if that's a good solution or not. Perhaps just catching the exception and returning the unsorted list is better. Up for debate.
Expected Behavior
It should either sort properly and return the sorted indices, or not sort at all and return the original list.
Steps to Reproduce
Errors or Screenshots
https://gist.github.com/sovdeeth/382e65dc312991bfae2f32def6e5cc42
Hacky comparator for String, Number that did work as a solution:
Other
No response
Agreement
The text was updated successfully, but these errors were encountered: