如何使用mongo hadoop访问名为“my.study.stable”的mongodb集合

h9a6wy2h  于 2021-06-26  发布在  Hive
关注(0)|答案(1)|浏览(420)

mongodb中有一个名为“my.study.stable”的集合。现在我使用用于hadoop的mongodb连接器(hive)来连接集合。我的create语句是

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

create语句执行成功。但是当我查询数据时,出现如下错误:

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.
0ejtzxu1

0ejtzxu11#

错误是由于 SampleSplitter 无法处理来自mongodb的大量数据,因此要解决此问题,请在用于调用hadoop的行中指定一个不同的拆分器,如 mongo.splitter.class=com.mongodb.hadoop.splitter.StandaloneMongoSplitter

相关问题