我正在尝试将 astring
和int
from map
in粘贴Hive
到array
. 目前,记录如下所示:
{"string1":1,"string2":1,"string3":15}
有没有办法将它转换为这样的数组:
["string1:1","string2:1","string3:15"]
我正在尝试将 astring
和int
from map
in粘贴Hive
到array
. 目前,记录如下所示:
{"string1":1,"string2":1,"string3":15}
有没有办法将它转换为这样的数组:
["string1:1","string2:1","string3:15"]
假设您的地图被称为“M”并且您希望您的数组字段被称为“A”
SELECT
...
array(concat_ws(":","string1",M[1]),
concat_ws(":","string2",M[2]),
concat_ws(":","string3",M[3]) as A
....
FROM table;