2017-02-22 11 views
0

ハイブにシンクでJSONデータをロードしようとしています。 しかし、それは次のエラーで失敗します。データのFlume Hiveシンクで配列のJSONをシリアライズできませんでした

WARN org.apache.hive.hcatalog.data.JsonSerDe: Error [java.io.IOException: Field name expected] parsing json text [{"id": "12345", "url": "https://mysite", "title": ["MyTytle"]}]. 
INFO org.apache.flume.sink.hive.HiveWriter: Parse failed : Unable to convert byte[] record into Object : {"id": "12345", "url": "https://mysite", "title": ["MyTytle"]} 

例:ハイブテーブルの

{"id": "12345", "url": "https://mysite", "title": ["MyTytle"]} 

説明:

id    string          
url    string          
title   array<string>        
time   string          

# Partitions 
time   string 

とJSONデータdoesnの場合、それは正常に動作と同じ方法配列(およびHiveテーブルのいずれか)も含まれていません。

水路バージョン:1.7.0(5.10 ClouderaのCDH)

シンク水路ハイブ経由配列でJSONデータをロードすることが可能としていますか?

答えて

0

Flume Hive sinkを経由してJSONデータを配列で読み込むことはできますか?

私は自分自身を試みたことがないにもかかわらず可能です。投稿者:

https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.0/bk_HDP_RelNotes/content/ch01s08s02.html

Following serializers are provided for Hive sink:

JSON: Handles UTF8 encoded Json (strict syntax) events and requires no configuration. Object names in the JSON are mapped directly to columns with the same name in the Hive table. Internally uses org.apache.hive.hcatalog.data.JsonSerDe but is independent of the Serde of the Hive table. This serializer requires HCatalog to be installed.

だから、多分あなたはSerDeで何か間違ったことを実施しています。あなたが試すこと

Parse json arrays using HIVE

もう一つはSerDeを変更することです:このユーザーは、前の正規表現を実行することにより、アレイとJSONを直列化の問題を解決しました。少なくとも、あなたは、この2つのオプションがあります(おそらくいくつかのより多くがあります):

関連する問題