linzhengen / tech-notes

My tech notes write in github issues🧲
1 stars 0 forks source link

[20210622] JSON SerDe ライブラリでネストされたjsonの対応は、serdepropertiesのpathsではなく、structを使う必要がある!!! #115

Open linzhengen opened 3 years ago

linzhengen commented 3 years ago

Doc

https://docs.aws.amazon.com/ja_jp/athena/latest/ug/json-serde.html

イメージしていたもの(paths)

CREATE EXTERNAL TABLE impressions (
...
    requesttime:string
)   
PARTITIONED BY (dt string)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
with serdeproperties ( 'paths'='timers.requesttime' )
LOCATION 's3://myregion.elasticmapreduce/samples/hive-ads/tables/impressions';

structでの対応が必要

CREATE EXTERNAL TABLE impressions (
...
    timers struct<
       requesttime:string>,
)   
PARTITIONED BY (dt string)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
LOCATION 's3://myregion.elasticmapreduce/samples/hive-ads/tables/impressions';