14
我已將配置單元版本從0.20更新爲0.13.1。在配置單元腳本中使用json_tuple語法時發生錯誤
我使用下面的表格和查詢從S3中提取json。
表:
> CREATE EXTERNAL TABLE in_app_logs (
> event string,
> app_id string,
> idfa string,
> idfv string
>)ROW FORMAT DELIMITED
> FIELDS TERMINATED BY '\t'
> LOCATION 's3://test/in_app_logs/ds=2015-04-20/';
我的查詢看起來喜歡低於0.20版本和它的正常工作與舊版本。
SELECT
get_json_object(in_app_logs.event, '$.ev') as event_type,
get_json_object(in_app_logs.event, '$.global.app_id') as app_id,
get_json_object(in_app_logs.event, '$.global.ios.idfa') as idfa,
get_json_object(in_app_logs.event, '$.global.ios.idfv') as idfv
FROM in_app_logs;
在新版本中,它更改爲json_tuple。我已經在更新後的版本中試過這個查詢。 有錯誤。
SELECT b.event_type, c.app_id, d.idfa, d.idfv
FROM in_app_logs a
LATERAL VIEW json_tuple(a.event, 'ev') b as event_type,
LATERAL VIEW json_tuple(a.event.global, 'app_id') c as app_id,
LATERAL VIEW json_tuple(a.event.global.ios, 'idfa', 'idfv') d as idfa, idfv
S3日誌:
{
"installed_at": "2015-04-17T12:10:24Z",
"ev": "event_install",
"global": {
"ios": {
"idfv": "887DF776-C1FC-4567-DESF-741AC72197D1",
"time_zone": "EDT",
"model": "iPhone7,2",
"screen_size": "320x568",
"carrier": "AT&T",
"language": "en",
"idfa": "CD04291C-0D80-4377-6CS9-B46089A05F15",
"os_version": "8.2.0",
"country": "US"
}
誰能幫我提取JSON數據?
你有從老版本的輸出樣本。你能分享你得到的錯誤/日誌嗎?什麼是文件格式,是.json文件。 –
什麼錯誤?請添加到帖子。 – javadba