Open kaisecheng opened 1 month ago
Pinging code owners:
pkg/ottl: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley
See Adding Labels via Comments if you do not have permissions to add labels yourself.
@evan-bradley I can work on this feature. Do you think the description is clear enough to start?
This makes sense to me. @TylerHelmuth let us know if you have any concerns.
The values will only be compared as strings, but not actually changed, right?
The values will only be compared as strings, but not actually changed, right?
Yes. The underlying values are not changed. Sort() makes a copy. Numeric array compare as numbers. Bools, strings and mixed types compare as strings. Other types are returned as-is
Ok cool. I'd like to see a PR for this feature.
Component(s)
pkg/ottl
Is your feature request related to a problem? Please describe.
I wanna sort an array in attribute in ascending or descending order to improve readability and simplify data processing.
Describe the solution you'd like
The Sort() function should accept an input array and return a new array sorted in either ascending or descending order.
The function should support sorting arrays of different types, including integers, floats, strings, and booleans. For boolean arrays, elements will be converted to strings for comparison. For arrays containing mixed types (e.g., integers and strings), all elements will be converted to strings for comparison.
Describe alternatives you've considered
No response
Additional context
No response