How to sort a Scala List[Map[String, Any]] by an arbitrary number of keys in the Map? -


i have list[map[string, any]] represents results of query.

the keys of map instance (or row) column names.

each query different , result may contain different set of columns, compared other query. queries cannot predicted in advance, hence cannot use case classes represent result row.

within results given query, columns appear in every row.

the values largely int, double , string types.

i need able sort results multiple columns, in both ascending , descending order.

for example, in pseudocode / sql:

order column1 asc, column2 desc, column3 asc

i have 3 distinct problems:

  1. sort single column type (in map, opposed underlying type) any
  2. sort either direction
  3. chain multiple sort instructions together

how can this?

update

i can part 1. , part 2. writing custom ordering[any]. don't yet know how chain sorts together.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -