10

I am trying to search a column having the data type map(varchar,varchar). Now one way to access the column is to use this structure, name_of_column['key'], which will give the value for that key. But I want to know what are possible keys and then apply group by and other operations based on those keys.

I tried searching on the internet but was not able to find appropriate solution.

Piotr Findeisen
  • 19,480
  • 2
  • 52
  • 82
arman
  • 414
  • 2
  • 6
  • 19

1 Answers1

9

Presto offers map_keys function for that:

presto> select map_keys(map(array['alice'], array['has a cat']));
  _col0
---------
 [alice]
(1 row)
Piotr Findeisen
  • 19,480
  • 2
  • 52
  • 82