FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. com/mongodb/util/JSON
阿新 • • 發佈:2018-07-11
uri object red handle column got 文件夾 tid tails )STORED BY ‘com.mongodb.hadoop.hive.MongoStorageHandler‘WITH SERDEPROPERTIES(‘mongo.columns.mapping‘=‘{"id":"_id","userid":"user_id","age":"age","status":"status"}‘)TBLPROPERTIES(‘mongo.uri‘=‘mongodb://localhost:27017/mydb.users‘); { "_id" : ObjectId("5b45705ca93daf7ae53e8b2a"), "user_id" : "bcd001", "age" : 45, "status" : "C" } > age bigint, > status string > ) > STORED BY ‘com.mongodb.hadoop.hive.MongoStorageHandler‘ > WITH SERDEPROPERTIES(‘mongo.columns.mapping‘=‘{"id":"_id","userid":"user_id","age":"age","status":"status"}‘) > TBLPROPERTIES(‘mongo.uri‘=‘mongodb://localhost:27017/mydb.users‘);OKTime taken: 1.431 secondshive> select * from mongotohive;OK5b456e33a93daf7ae53e6419 abc123 58 D5b45705ca93daf7ae53e8b2a bcd001 45 CTime taken: 0.601 seconds, Fetched: 2 row(s)hive>
問題:
將MongoDB數據導入Hive,按照https://blog.csdn.net/thriving_fcl/article/details/51471248文章,在hive建外部表與mongodb做映射後,執行後出現
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. com/mongodb/util/JSON建表語句如下:
CREATE EXTERNAL TABLE mongotohive( id string, userid string, age bigint, status stringmongodb 數據如下:
db.users.find(){ "_id" : ObjectId("5b456e33a93daf7ae53e6419"), "user_id" : "abc123", "age" : 58, "status" : "D" }
解決方案:
將mongo-hadoop-core-2.0.0.jar、mongo-hadoop-hive-2.0.0.jar、mongo-java-driver-3.7.1.jar三個jar包放到hive的lib文件夾下後,再次運行成功。如下:
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. com/mongodb/util/JSON