【发布时间】:2018-11-27 03:18:51
【问题描述】:
我在雅典娜有一张这样结构的桌子
CREATE EXTERNAL TABLE `json_test`(
`col0` string ,
`col1` string ,
`col2` string ,
`col3` string ,
`col4` string ,
)
ROW FORMAT SERDE
'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES (
'quoteChar'='\"',
'separatorChar'='\;')
这样的Json String 存储在“col4”中:
{'email': 'test_email@test_email.com', 'name': 'Andrew', 'surname': 'Test Test'}
我正在尝试进行 json_extract 查询:
SELECT json_extract(col4 , '$.email') as email FROM "default"."json_test"
但查询返回空值。
任何帮助将不胜感激。
【问题讨论】:
-
是否引用了 json?我只是问,因为我已经看到 opencsvserde 解析所有数据而不是吐出错误,当你从 json_test 中选择 col4 时,你得到了你所期望的。
-
Json 没有被引用。如果我从 json_test 中选择 *,我会正确获取所有行
-
如果你从 json_test 中选择 col4,你会得到包含 json 的 col 吗?
-
我只是问,因为我刚刚运行了类似的东西并且遇到了问题。
-
是的,你是对的,我确实从 json_test 中选择 col4 并得到了 json 字符串
标签: json amazon-s3 hive amazon-athena presto