在配置单元中查询嵌套的json

时间:2019-05-09 12:01:49

标签: hadoop hive hiveql create-table

嗨,我有以下json数据

{
"posts": {
    "data": [{
        "message": "appatlo ma 1st mass bunk \ud83d\ude02\ud83d\ude02",
        "created_time": "2019-04-24T09:49:24+0000",
        "id": "1737728552979838_2124689027617120"
    }, {
        "created_time": "2019-03-10T09:26:10+0000",
        "id": "1737728552979838_2060832820669408"
    }, {
        "message": "Srujay Kunaparaju Chanakya Reddy Vajrala\n\ud83d\ude02\ud83d\ude02",
        "created_time": "2019-02-26T05:19:35+0000",
        "id": "1737728552979838_2044396018979755"
    }, {
        "message": "**feeling excited**  updating my status using Facebook APIand R!!!!!!:",
        "created_time": "2018-03-02T05:09:17+0000",
        "id": "1737728552979838_1587397974679564"
    },   {
        "message": "Best time \ud83d\ude0a",
        "created_time": "2017-07-09T13:37:58+0000",
        "id": "1737728552979838_1371026749650022"
    }],
    "paging": {
        "previous": "https:\/\/graph.facebook.com\/v3.3\/1737728552979838\/posts?since=1556099364&access_token=EAAXYJIbZC8bIBADFiMdTfKmiuRwy18cofurdn3pxAXeyU6e2Wm2okKC84m4dygQVQCxxZAQimCeD1llU1gRWylJlb7X7NmDVyNethzSXjzKlSt4JoyvoY5TSL4K0VCljApSIAuGbKZAmzWJvwKLBZCVwqosFal89wAUDI1i9WF8H1TVqWXr2YIUgWKAQYdQZD&limit=25&__paging_token=enc_AdCuJ0NVhBVDlYItdB74FhgfkvyZBBrJI959ZBKy4WT58RD7ZBII9V9C1Jwm0IZBvN5hCesTc7ZAeiDvBDxrZCH3QyZAZBf26Owwb6mjVrCAV3iuaKBkHwZDZD&__previous=1",
        "next": "https:\/\/graph.facebook.com\/v3.3\/1737728552979838\/posts?access_token=EAAXYJIbZC8bIBADFiMdTfKmiuRwy18cofurdn3pxAXeyU6e2Wm2okKC84m4dygQVQCxxZAQimCeD1llU1gRWylJlb7X7NmDVyNethzSXjzKlSt4JoyvoY5TSL4K0VCljApSIAuGbKZAmzWJvwKLBZCVwqosFal89wAUDI1i9WF8H1TVqWXr2YIUgWKAQYdQZD&limit=25&until=1499607478&__paging_token=enc_AdB7f1IN9AkJEYXacM1pGtA4bQRgzfoPk3n9MXp5dVH0UyOjUBKa1wdQljPZBV1xk5V5FCXCJWJYRXSfSGakPSS99CTP7FxFteubA4C8F7ZCNiPQZDZD"
    }
},
"id": "1737728552979838"
}

现在我已经尝试在蜂巢中进行如下查询

蜂巢查询:

create table fbdata(
posts struct<data struct< message:string,created_time:string,id:string> paging< previous:string,next:string> id:string>
)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe' 
STORED AS TEXTFILE
location '/user/facebookdata/facebook1557381559388.json' ;

我遇到以下错误,任何人都可以帮助我 错误:

  

编译语句时出错:失败:ParseException行1:38   缺少:在结构类型行1:92中'>'附近的'struct'不匹配   输入“分页”,期望>结构类型中的“>”附近   (状态= 42000,代码= 40000)

0 个答案:

没有答案