I am trying to paste a string
and int
from map
in Hive
to an array
.
For now, record looks like this:
{"string1":1,"string2":1,"string3":15}
Is there a way to convert it to an array like this:
["string1:1","string2:1","string3:15"]
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.
Sign up to join this communityAssuming your map is called "M" and you want your array field to be called "A"
SELECT
...
array(concat_ws(":","string1",M[1]),
concat_ws(":","string2",M[2]),
concat_ws(":","string3",M[3]) as A
....
FROM table;