Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

60 views
Skip to first unread message

hadoopmongouser

unread,
May 23, 2018, 4:10:18 PM5/23/18
to mongodb-user
Hi,

I am facing the error:

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. com/mongodb/util/JSON

I am using the link 
https://github.com/mongodb/mongo-hadoop/wiki/Hive-Usage to pull the data from mongodb collection to hive

The jars i have added to hive session are
mongo-hadoop-core-2.0.2.jar;
mongo-hadoop-hive-2.0.2.jar;
mongo-java-driver-3.7.0.jar;

I am using hdp 2.6 and hive version 1.2.1 and mongo db - 3.6.2

I have a mongo db collection
{
  first_name:"John2",
  last_name:"Doe2",
  memberships: ["mem12","mem22"],
  address:{
  street:"42 main st",
  city:"Boston"
  }
}

I am creating the hive external table like below

CREATE EXTERNAL TABLE individuals
  first_name INT,
  last_name STRING
)
STORED BY 'com.mongodb.hadoop.hive.MongoStorageHandler'
WITH SERDEPROPERTIES('mongo.columns.mapping'='{"first_name":"fname","last_name":"lname"}')
TBLPROPERTIES('mongo.uri'='mongodb://[user:password@]<MongoDB Instance IP>:27017/DBname.collectionName');

I am seeing the error above error.Can someone please help what went wrong.

Thanks in advance.

Wan Bachtiar

unread,
May 31, 2018, 4:29:13 AM5/31/18
to mongodb-user

I am seeing the error above error.Can someone please help what went wrong.

Hi,

Are there any additional error lines?

CREATE EXTERNAL TABLE individuals

You’re defining first_name field to be INT, shouldn’t name values be string similar to last_name

WITH SERDEPROPERTIES(‘mongo.columns.mapping’=’{“first_name”:”fname”,”last_name”:”lname”}’)

If the fields in the MongoDB collection are first_name and last_name then you would want to map them the same as well.
Try:

WITH SERDEPROPERTIES('mongo.columns.mapping'='{"first_name":"first_name","last_name":"last_name"}')

See also BSONSerDe Mappings

Regards,
Wan.

Reply all
Reply to author
Forward
0 new messages