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

问题描述 投票:1回答:2

mongodb中有一个名为“ my.study.stable”的集合。现在,我使用MongoDB Connector for Hadoop(hive)连接集合。我的创建语句是

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.

mongodb中有一个名为“ my.study.stable”的集合。现在,我使用MongoDB Connector for Hadoop(hive)连接集合。我的create语句是CREATE EXTERNAL TABLE mytable(...

mongodb hive connector
2个回答
0
投票

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


-1
投票

@@ Daniel-我们需要在表ddl中提及此类用法吗?你能举个例子吗?

© www.soinside.com 2019 - 2024. All rights reserved.