2016-07-22 29 views
0

Erstens, ich bin neu in Hive.JSON Parsing Fehler beim Erstellen der HIVE Tabelle

Ich holte twitter Daten durch Apache-Kanal.

{ 
"filter_level": "low", 
"retweeted": false, 
"in_reply_to_screen_name": null, 
"possibly_sensitive": false, 
"truncated": false, 
"lang": "en", 
"in_reply_to_status_id_str": null, 
"id": 756378998838530048, 
"in_reply_to_user_id_str": null, 
"timestamp_ms": "1469169780822", 
"in_reply_to_status_id": null, 
"created_at": "Fri Jul 22 06:43:00 +0000 2016", 
"favorite_count": 0, 
"place": null, 
"coordinates": null, 
"text": "#furry pokemon sex mermaid sex position", 
"contributors": null, 
"geo": null, 
"entities": { 
    "symbols": [], 
    "urls": [{ 
     "expanded_url": "http://14.gerase.tk", 
     "indices": [40, 63], 
     "display_url": "14.gerase.tk", 
     "url": "" 
    }], 
    "hashtags": [{ 
     "text": "furry", 
     "indices": [0, 6] 
    }], 
    "user_mentions": [] 
}, 
"is_quote_status": false, 
"source": "<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client<\/a>", 
"favorited": false, 
"in_reply_to_user_id": null, 
"retweet_count": 0, 
"id_str": "756378998838530048", 
"user": { 
    "location": null, 
    "default_profile": true, 
    "statuses_count": 3436, 
    "profile_background_tile": false, 
    "lang": "ru", 
    "profile_link_color": "2B7BB9", 
    "id": 752318303280955392, 
    "following": null, 
    "favourites_count": 0, 
    "protected": false, 
    "profile_text_color": "333333", 
    "verified": false, 
    "description": null, 
    "contributors_enabled": false, 
    "profile_sidebar_border_color": "C0DEED", 
    "name": "Мария Виноградова", 
    "profile_background_color": "F5F8FA", 
    "created_at": "Mon Jul 11 01:47:15 +0000 2016", 
    "default_profile_image": false, 
    "followers_count": 5, 
    "profile_image_url_https": "https://pbs.twimg.com/profile_images/753398763201425408/X_2mAGt1_normal.jpg", 
    "geo_enabled": false, 
    "profile_background_image_url": "", 
    "profile_background_image_url_https": "", 
    "follow_request_sent": null, 
    "url": null, 
    "utc_offset": null, 
    "time_zone": null, 
    "notifications": null, 
    "profile_use_background_image": true, 
    "friends_count": 21, 
    "profile_sidebar_fill_color": "DDEEF6", 
    "screen_name": "afinafedorova2", 
    "id_str": "752318303280955392", 
    "profile_image_url": "http://pbs.twimg.com/profile_images/753398763201425408/X_2mAGt1_normal.jpg", 
    "listed_count": 5, 
    "is_translator": false 
} 

}

I HiveJSONSerDe bin mit wie in https://github.com/cloudera/cdh-twitter-example erwähnt Und das ist die Hive Abfrage ich zu starten versuchen.

Aber es zeigt einen Fehler beim Parsen des JSON-Skripts.

FAILED: Parse Error: line 31:2 mismatched input 'location' expecting identifier in column specification 

Ich kann nicht die Fehler in dieser Abfrage erstellen Tabelle finden. Bitte Hilfe.

Antwort

0

Sie können sich diese Zeile in der Datendatei ansehen. Es ist sehr wahrscheinlich, dass Ihre JSON-Datei nicht intakt ist oder nicht mit dem Schema übereinstimmt.

Wenn Sie fortlaufend Daten in eine Hive-Tabelle laden möchten, sollten Sie auch StreamSets ausprobieren. Sie können damit JSON-Daten erfassen, automatisch in Avro konvertieren und eine Hive-Tabelle auffüllen und aktualisieren.

Volle Offenlegung, ich bin ein Committer auf dem Projekt.

+1

Eigentlich ist "Standort" selbst ein Schlüsselwort im Bienenstock, das nicht als Attributname verwendet werden kann. Entschuldigung, ich habe meine Frage bearbeitet. :) – Bihan