使用动态JSON架构将Json文件加载到配置单元中

时间:2019-01-24 01:17:19

标签: hive hiveql

我正在尝试将 yelp_business JSON加载到配置单元表中,但无法在配置单元中为此json文件创建架构。请让我知道如何在蜂巢中为以下内容创建架构。 根据业务的不同,配置单元中的属性会发生变化,而我在创建表时使用的是json serde。

{
    "business_id": "8-NRKkPY1UiFXW20WXKiXg",
    "name": "Filiberto's Mexican Food",
    "neighborhood": "",
    "address": "1440 N. Dysart Ave",
    "city": "Avondale",
    "state": "AZ",
    "postal_code": "85323",
    "latitude": 33.4481059352,
    "longitude": -112.341302074,
    "stars": 2.5,
    "review_count": 40,
    "is_open": 1,
    "attributes": {
        "Alcohol": "none",
        "Ambi
        ence": "{'romantic': False, 'intimate': False, 'classy': False, 'hipster': False, 'divey': False, 'touristy': False, 'trendy': False, 'upscale': False, 'c
        asual': True}",
        "BikeParking": "True",
        "BusinessAcceptsCreditCards": "True",
        "BusinessParking": "{'garage': False, 'street': False, 'validated': False, 'lot':
        True, 'valet': False}",
        "Caters": "False",
        "GoodForKids": "True",
        "GoodForMeal": "{'dessert': False, 'latenight': True, 'lunch': False, 'dinner': False, 'break
        fast': False, 'brunch': False}",
        "HasTV": "False",
        "NoiseLevel": "average",
        "OutdoorSeating": "False",
        "RestaurantsAttire": "casual",
        "RestaurantsDelivery": "False
        ",
        "RestaurantsGoodForGroups": "True",
        "RestaurantsPriceRange2": "1",
        "RestaurantsReservations": "False",
        "RestaurantsTableService": "False",
        "RestaurantsTakeOut"
        : "True",
        "WheelchairAccessible": "True",
        "WiFi": "no"
    },
    "categories": "Mexican, Restaurants",
    "hours": {
        "Monday": "0:0-0:0",
        "Tuesday": "0:0-0:0",
        "Wednesday": "0:0-0
        :0",
        "Thursday": "0:0-0:0",
        "Friday": "0:0-0:0",
        "Saturday": "0:0-0:0",
        "Sunday": "0:0-0:0"
    }
}
{
    "business_id": "UTm5QZThPQlT35mkAcGOjg",
    "name": "Maggie & Stella's Gifts",
    "neighborhood": "Oakland",
    "address": "209 Oakland Ave",
    "city": "Pittsburgh",
    "state"
    : "PA",
    "postal_code": "15213",
    "latitude": 40.4414214,
    "longitude": -79.9564571,
    "stars": 3.5,
    "review_count": 3,
    "is_open": 1,
    "attributes": {
        "BikeParking": "True",
        "Bu
        sinessAcceptsCreditCards": "True",
        "BusinessParking": "{'garage': False, 'street': False, 'validated': False, 'lot': False, 'valet': False}",
        "RestaurantsPri
        ceRange2": "2"
    },
    "categories": "Flowers & Gifts, Gift Shops, Shopping",
    "hours": {
        "Monday": "9:0-18:0",
        "Tuesday": "9:0-18:0",
        "Wednesday": "9:0-18:0",
        "Thursday": "
        9:0-18:0",
        "Friday": "9:0-17:0",
        "Saturday": "10:0-17:0"
    }
}

1 个答案:

答案 0 :(得分:0)

配置单元不处理动态模式。

您可以做的是提供天气是否适用的所有属性。