我的配置單元代碼中有一個問題。我想提取JSON數據使用HIVE.Following爲樣本JSON格式使用HIVE從JSON中提取字段
{"Rtype":{"ver":"1","os":"ms","type":"ns","vehicle":"Mh-3412","MOD":{"Version":[{"versionModified"{"machine":"123.dfer","founder":"3.0","state":"Florida","fashion":"fg45","cdc":"new","dof":"yes","ts":"2000-04-01T00:00:00.171Z"}}]}}}
我希望得到以下領域
- 版本
- 型
- 車輛
- TS
- 創始人
- 狀態
問題是創始人和國家是在一個陣列「版本」 任何人都可以幫助如何擺脫這一點? 一些時間,而不是別的versionmedified東西可能會
如: 有些時候我的數據會是怎樣
{"Rtype":{"ver":"1","os":"ms","type":"ns","vehicle":"Mh-3412","MOD":{"Version":[{"anotherCriteria":{"engine":"123.dfer","developer":"3.0","state":"Florida","fashion":"fg45","cdc":"new","dof":"yes","ts":"2000-04-01T00:00:00.171Z"}}]}}}
添加下面的一些樣本數據:
{"Rtype":{"ver":"1","os":"ms","type":"ns","vehicle":"Mh-3412","MOD":{"Version":[{"ABC"{"XYZ":"123.dfer","founder":"3.0","GHT":"Florida","fashion":"fg45","cdc":"new","dof":"yes","ts":"2000-04-01T00:00:00.171Z"}}]}}}
{"Rtype":{"ver":"1","os":"ms","type":"ns","vehicle":"Mh-3412","MOD":{"Version":[{"GAP"{"XVY":"123.dfer","FAH":"3.0","GHT":"Florida","fashion":"fg45","cdc":"new","dof":"yes","ts":"2000-04-01T00:00:00.171Z"}}]}}}
{"Rtype":{"ver":"1","os":"ms","type":"ns","vehicle":"Mh-3412","MOD":{"Version":[{"BOX"{"VOG":"123.dfer","FAH":"3.0","FAX":"Florida","fashion":"fg45","cdc":"new","dof":"yes","ts":"2000-04-01T00:00:00.171Z"}}]}}}
我需要把這個數據基於版本的各種表格如果它是「BOX」放在一個表中如果它是「GAP」把另一個表...
指這在蜂巢使用get_json_object .. ..http://stackoverflow.com/questions/24447428/parse-json-arrays-using-hive –
請顯示您的表架構 –
不要混淆問題。爲INSERTissue –