Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 03-22-2016 07:28 AM
Jar -> mongo-hadoop-core-1.4.0,mongo-hadoop-hive-1.4.0,mongo-java-driver-2.10.1
hive> CREATE EXTERNAL TABLE minute_bars > ( > > id STRING, > Symbol STRING, > `Timestamp` STRING, > Day INT, > Open DOUBLE, > High DOUBLE, > Low DOUBLE, > Close DOUBLE, > Volume INT > ) > STORED BY 'com.mongodb.hadoop.hive.MongoStorageHandler' > WITH SERDEPROPERTIES('mongo.columns.mapping'='{"id":"_id", > "Symbol":"Symbol", "Timestamp":"Timestamp", "Day":"Day", "Open":"Open", "High":"High", "Low":"Low", "Close":"Close", "Volume":"Volume"}') > TBLPROPERTIES('mongo.uri'='mongodb://localhost:27017/marketdata.minbars'); FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. com/mongodb/hadoop/io/BSONWritable hive>
Created 03-23-2016 08:01 AM
have you seen this https://community.hortonworks.com/content/repo/4538/hdp-mongo-tutorial.html ? Also mongo driver is now at 1.4.2, it may be worth your time to use latest jar. https://github.com/mongodb/mongo-hadoop/releases
Created 03-22-2016 08:15 AM
You could try adding both the "mongo-hadoop-hive.jar" and "mongo-hadoop-core.jar" to the hive.aux.jars.path setting in your hive-site.xml.
Or
You can simply add those jars in your hive shell like,
hive> add "somepath/mongo-hadoop-hive.jar"
hive> add "somepath/mongo-hadoop-core.jar"
Created 03-22-2016 10:56 AM
i alrady done that step
hive> add "somepath/mongo-hadoop-hive.jar"
hive> add "somepath/mongo-hadoop-core.jar"
Created 03-22-2016 03:31 PM
Ok, can you also try using hive aux path?
Created 03-23-2016 08:01 AM
have you seen this https://community.hortonworks.com/content/repo/4538/hdp-mongo-tutorial.html ? Also mongo driver is now at 1.4.2, it may be worth your time to use latest jar. https://github.com/mongodb/mongo-hadoop/releases
Created 03-30-2016 11:40 PM
I got it to work with the following in my repo I linked earlier
hdfs dfs -put drivers/* /tmp/udfs
beeline
!connect jdbc:hive2://localhost:10000 “” ””
add jar hdfs://sandbox.hortonworks.com:8020/tmp/udfs/mongo-hadoop-hive-1.5.0-SNAPSHOT.jar;
add jar hdfs://sandbox.hortonworks.com:8020/tmp/udfs/mongo-hadoop-core-1.5.0-SNAPSHOT.jar;
add jar hdfs://sandbox.hortonworks.com:8020/tmp/udfs/mongodb-driver-3.0.4.jar;
DROP TABLE IF EXISTS bars;
CREATE EXTERNAL TABLE bars
(
objectid STRING,
Symbol STRING,
TS STRING,
Day INT,
Open DOUBLE,
High DOUBLE,
Low DOUBLE,
Close DOUBLE,
Volume INT
)
STORED BY 'com.mongodb.hadoop.hive.MongoStorageHandler'
WITH SERDEPROPERTIES('mongo.columns.mapping'='{"objectid":"_id",
"Symbol":"Symbol", "TS":"Timestamp", "Day":"Day", "Open":"Open", "High":"High", "Low":"Low", "Close":"Close", "Volume":"Volume"}')
TBLPROPERTIES('mongo.uri'='mongodb://localhost:27017/marketdata.minibars');