When we are working with complex structure of data like avro.
Most of the times we are encountering array contains multiple tuples and each tuple have struct schema.
Suppose here struct schema is like below:
Then while running our hive query complex array looks like array of employee objects.
When we are implementing business use cases day to day life we are encountering problems like sorting a tuple array by specific field[s] like empId,name,salary,etc by ASC or DESC order.
I have developed a udf 'sort_array_by' which will sort a tuple array by one or more fields in ASC or DESC order provided by user ,default is ascending order .