Bet*_*lee 2 hive presto amazon-athena
我想从AWS中的Athena获取结果值格式JSON。
当我从雅典娜选择时,结果格式如下。
{test.value={report_1=test, report_2=normal, report_3=hard}}
Run Code Online (Sandbox Code Playgroud)
有什么方法可以将JSON格式的结果替换为“:”?
列格式为
map<string,map<string,string>>
Run Code Online (Sandbox Code Playgroud)
select mycol
from mytable
;
Run Code Online (Sandbox Code Playgroud)
+--------------------------------------------------------------+
| mycol |
+--------------------------------------------------------------+
| {test.value={report_3=hard, report_2=normal, report_1=test}} |
+--------------------------------------------------------------+
Run Code Online (Sandbox Code Playgroud)
select cast (mycol as json) as json
from mytable
;
Run Code Online (Sandbox Code Playgroud)
+--------------------------------------------------------------------------+
| json |
+--------------------------------------------------------------------------+
| {"test.value":{"report_1":"test","report_2":"normal","report_3":"hard"}} |
+--------------------------------------------------------------------------+
Run Code Online (Sandbox Code Playgroud)