为嵌套json数据创建配置单元表

cyvaqqii  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(358)

我正在尝试为我的json数据创建一个配置单元表。创建表时出错。
这是我的数据。

{"page_1":"{\"city\":\"Bangalore\",\"locality\":\"Battarahalli\",\"Name_of_Person\":\"xxx\",\"User_email_address\":\"xxxx@gmail.com\",\"user_phone_number\":\"\",\"sub_locality\":\"\",\"street_name\":\"4th Cross, Near Reliance Fresh,\",\"home_plot_no\":\"5\",\"pin_code\":\"560049\",\"project_society_build_name\":\"Sunshine Layout\",\"landmark_reference_1\":\"\",\"landmark_reference_2\":\"\",\"No_of_Schools\":20,\"No_of_Hospitals\":20,\"No_of_Metro\":0,\"No_of_Mall\":11,\"No_of_Park\":10,\"Distance_of_schools\":1.55,\"Distance_of_Hospitals\":2.29,\"Distance_of_Metro\":0,\"Distance_of_Mall\":1.55,\"Distance_of_Park\":2.01,\"lat\":13.0243273,\"lng\":77.7077906,\"ipinfo\":{\"ip\":\"113.193.30.130\",\"hostname\":\"No Hostname\",\"city\":\"\",\"region\":\"\",\"country\":\"IN\",\"loc\":\"20.0000,77.0000\",\"org\":\"AS45528 Tikona Digital Networks Pvt Ltd.\"}}","page_2":"{\"home_type\":\"Flat\",\"area\":\"1350\",\"beds\":\"3 BHK\",\"bath_rooms\":2,\"building_age\":\"1\",\"floors\":2,\"balcony\":2,\"amenities\":\"premium\",\"amenities_options\":{\"gated_security\":\"\",\"physical_security\":\"\",\"cctv_camera\":\"\",\"controll_access\":\"\",\"elevator\":true,\"power_back_up\":\"\",\"parking\":true,\"partial_parking\":\"\",\"onsite_maintenance_store\":\"\",\"open_garden\":\"\",\"party_lawn\":\"\",\"amenities_balcony\":\"\",\"club_house\":\"\",\"fitness_center\":\"\",\"swimming_pool\":\"\",\"party_hall\":\"\",\"tennis_court\":\"\",\"basket_ball_court\":\"\",\"squash_coutry\":\"\",\"amphi_theatre\":\"\",\"business_center\":\"\",\"jogging_track\":\"\",\"convinience_store\":\"\",\"guest_rooms\":\"\"},\"interior\":\"regular\",\"interior_options\":{\"tiles\":true,\"marble\":\"\",\"wooden\":\"\",\"modular_kitchen\":\"\",\"partial_modular_kitchen\":\"\",\"gas_pipe\":\"\",\"intercom_system\":\"\",\"air_conditioning\":\"\",\"partial_air_conditioning\":\"\",\"wardrobe\":\"\",\"sanitation_fixtures\":\"\",\"false_ceiling\":\"\",\"partial_false_ceiling\":\"\",\"recessed_lighting\":\"\"},\"location\":\"regular\",\"location_options\":{\"good_view\":true,\"transporation_hub\":true,\"shopping_center\":\"\",\"hospital\":\"\",\"school\":\"\",\"ample_parking\":\"\",\"park\":\"\",\"temple\":\"\",\"bank\":\"\",\"less_congestion\":\"\",\"less_pollution\":\"\"},\"maintenance\":\"\",\"maintenance_value\":\"\",\"near_by\":{\"school\":\"\",\"hospital\":\"\",\"mall\":\"\",\"park\":\"\",\"metro\":\"\",\"Near_by_school\":\"Little Champ Gurukulam Pre School \\\/ 1.52 km\",\"Near_by_hospital\":\"Suresh Hospital \\\/ 2.16 km\",\"Near_by_mall\":\"LORVEN LEO \\\/ 2.13 km\",\"Near_by_park\":\"SURYA ENCLAIVE \\\/ 2.09 km\"},\"city\":\"Bangalore\",\"locality\":\"Battarahalli\",\"token\":\"344bd4f0fab99b460873cfff6befb12f\"}"}

这是我的表创建语句

CREATE EXTERNAL TABLE Hive_Json_ORC (
page_1 array<struct<
city : STRING, 
locality : STRING, 
Name_of_Person : STRING, 
User_email_address : STRING, 
user_phone_number : STRING, 
sub_locality : STRING, 
street_name :  STRING, 
home_plot_no : STRING, 
pin_code : STRING, 
project_society_build_name : STRING, 
landmark_reference_1 : STRING, 
landmark_reference_2 : STRING, 
No_of_Schools : STRING, 
No_of_Hospitals : STRING, 
No_of_Metro : STRING, 
No_of_Mall : STRING, 
No_of_Park : STRING, 
Distance_of_schools : STRING, 
Distance_of_Hospitals : STRING, 
Distance_of_Metro : STRING, 
Distance_of_Mall : STRING, 
Distance_of_Park : STRING, 
lat : STRING, 
lng : STRING
>>,
ipinfo map<string,string>
page_2 array<struct<
home_type : STRING, 
area : STRING, 
beds : STRING, 
bath_rooms : STRING, 
building_age : STRING, 
floors : STRING, 
balcony : STRING, 
amenities : STRING 
amenities_options map<string,string>
interior_options map<string,string>
location_options map<string,string>
near_by map<string,string>
>>,
)
ROW FORMAT SERDE 'ROW FORMAT SERDE "org.apache.hive.hcatalog.data.JsonSerDe'
LOCATION '/user/ec2-user/AddressInformation_ORC';

我得到以下错误

FAILED: ParseException line 30:1 mismatched input 'page_2' expecting ) near '>' in create table statement

我不知道我在哪里犯了错。任何帮助都将不胜感激。

js4nwp54

js4nwp541#

我想知道你是否需要一个 ipinfo map<string,string> .

相关问题