2017-03-16 29 views
1

在mongodb中有一個名爲'my.study.stable'的集合。 現在我使用MongoDB Connector for Hadoop(配置單元)連接集合。 我的create語句是如何使用mongo-hadoop訪問名爲「my.study.stable」的mongodb集合

CREATE EXTERNAL TABLE mytable(
 
\t song_id BIGINT, 
 
\t ctime BIGINT 
 
) 
 
STORED BY 'com.mongodb.hadoop.hive.MongoStorageHandler' 
 
WITH SERDEPROPERTIES('mongo.columns.mapping'= 
 
'{"song_id":"_id", 
 
"ctime":"ctime"}') 
 
TBLPROPERTIES('mongo.uri'='mongodb://username:[email protected]:port/mzk_spiders.my.study.stable');

CREATE語句excutes success.But當我查詢數據,我出現的錯誤是這樣的:

java.io.IOException: java.io.IOException: Failed to aggregate sample documents. Note that this Splitter implementation is incompatible with MongoDB versions prior to 3.2.

+0

集合的大小約爲4.3G –

+0

您是否找到解決方案?我得到相同的錯誤 –

+0

得到它的工作,請參閱下面的答案 –

回答

0

的由於SampleSplitter產生錯誤無法處理來自MongoDB的大量數據,因此爲了解決這個問題,請在您用來調用hadoop的行中指定不同的分離器,如mongo.splitter.class=com.mongodb.hadoop.splitter.StandaloneMongoSplitter

相關問題