【发布时间】:2019-09-11 21:13:36
【问题描述】:
我有一个 hive 表,它有两列 (day, type_of_day) 都是字符串类型
"monday" [{"temp" : 45, "weather": "rainny"}, {"temp" : 25, "weather": "sunny"}, {"temp" : 15, "weather": "storm"}]
"tuesday" [{"temp" : 5, "weather": "winter"}, {"temp" : 10, "weather": "sun"}, {"temp" : 18, "weather": "dawn"}]
我想拆分(我想爆炸是技术术语)然后只获取每天的天气列表。我熟悉如何在 python 中执行此操作,但有没有办法在 hive 中直接执行此操作。
"monday" [45, 25, 15]
"tuesday" [5, 10, 18]
【问题讨论】:
-
初始字符串也包含方括号,但不是数组,是字符串,对吧?我问这个是因为它像数组一样显示。你需要输出为数组吗?或字符串 "[45, 25, 15]" ?
-
是的,它是一个字符串。我希望输出是一个数组。
标签: sql arrays hive hiveql explode