In hive, I wish to sort an array from largest to smallest, and get the index array.
For example, the table is like this:
id | value_array
1 | {30, 40, 10, 20}
2 | {10, 30, 40, 20}
I with to get this:
id | value_array
1 | {1, 0, 3, 2}
2 | {2, 1, 3, 0}
The arries in result are the index of the initial elements. How can I achieve this?