Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask

Hadoop env - 2.6.0-cdh5.11.0
Elastic - 2.4.4
Hive - version 1.1.0-cdh5.11.0

So, i created a basic external table using the query :-

CREATE EXTERNAL TABLE testESHIVE (name STRING)
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'
TBLPROPERTIES('es.nodes' = 'xxxx', 'es.port' ='9220', 'es.resource' = 'hivedemo/sample', 'es.index.auto.create' = 'true');

I also created an index on elastic side with the name hivedemo.
Now, when i am trying to execute " INSERT OVERWRITE TABLE testESHIVE select * from demo " it throws the mentioned error(return code 2).
However, when i add any record into the index using sense, i am able to view the same through select query in Hive, which indicates that both elastic and hive is linked.
The issue is faced only when inserting from Hive side.

FULL STACK TRACE :-

INFO : Compiling command(queryId=hive_20171011042121_3882c424-79a5-466a-9249-aa0d5186e94a): insert overwrite table testeshive select * from demo
INFO : Semantic Analysis Completed
INFO : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:demo.name, type:string, comment:null)], properties:null)
INFO : Completed compiling command(queryId=hive_20171011042121_3882c424-79a5-466a-9249-aa0d5186e94a); Time taken: 0.132 seconds
INFO : Executing command(queryId=hive_20171011042121_3882c424-79a5-466a-9249-aa0d5186e94a): insert overwrite table testeshive select * from demo
INFO : Query ID = hive_20171011042121_3882c424-79a5-466a-9249-aa0d5186e94a
INFO : Total jobs = 1
INFO : Launching Job 1 out of 1
INFO : Starting task [Stage-0:MAPRED] in serial mode
INFO : Number of reduce tasks is set to 0 since there's no reduce operator
INFO : number of splits:1
INFO : Submitting tokens for job: job_1507691246139_0043
INFO : Kind: kms-dt, Service: 10.63.13.16:16000, Ident: (kms-dt owner=hive, renewer=yarn, realUser=, issueDate=1507710110641, maxDate=1508314910641, sequenceNumber=31716, masterKeyId=307)
INFO : Kind: HDFS_DELEGATION_TOKEN, Service: ha-hdfs:nameservice1, Ident: (token for hive: HDFS_DELEGATION_TOKEN owner=hive/r00f16n0c.bnymellon.net@CDHDEV.BNYMELLON.NET, renewer=yarn, realUser=, issueDate=1507710110610, maxDate=1508314910610, sequenceNumber=32101, masterKeyId=378)
INFO : The url to track the job: http://r00f16n0c.bnymellon.net:8088/proxy/application_1507691246139_0043/
INFO : Starting Job = job_1507691246139_0043, Tracking URL = http://r00f16n0c.bnymellon.net:8088/proxy/application_1507691246139_0043/
INFO : Kill Command = /opt/cloudera/parcels/CDH-5.11.0-1.cdh5.11.0.p0.34/lib/hadoop/bin/hadoop job -kill job_1507691246139_0043
INFO : Hadoop job information for Stage-0: number of mappers: 1; number of reducers: 0
INFO : 2017-10-11 04:21:56,674 Stage-0 map = 0%, reduce = 0%
INFO : 2017-10-11 04:22:15,229 Stage-0 map = 100%, reduce = 0%
ERROR : Ended Job = job_1507691246139_0043 with errors
ERROR : FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask
INFO : MapReduce Jobs Launched:
INFO : Stage-Stage-0: Map: 1 HDFS Read: 0 HDFS Write: 0 FAIL
INFO : Total MapReduce CPU Time Spent: 0 msec
INFO : Completed executing command(queryId=hive_20171011042121_3882c424-79a5-466a-9249-aa0d5186e94a); Time taken: 26.977 seconds
Error: Error while processing statement: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask (state=08S01,code=2)


Please help me out so as to rectify this issue asap.
Thanks

ERROR : FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask

Unfortunately, Hive doesn't give much to the end user/client in terms of helpful error messages. Could you include the logs from the Hive Server, as well as the logs from any failed Map/Reduce jobs that you are seeing when you run your Hive query? That should be where the important bits are for diagnosing the issue at hand.

Hi, actually this issue got resolved by org support team. Perhaps the elastic hadoop jar was supposed to be added in some other path as well.
However, the next set of challenge that i am facing is to use existing table . So, my current table has more than 100 columns, in it and defining schema for them explicitly will not be possible. So i was looking for ways to use exiting schema and then create an external table.
I did something like this :-

CREATE EXTERNAL TABLE demo LIKE testTable;

It runs successfully and copies the schema of testTable to demo table.
So "LIKE" basically copies the schema of existing table and assign it to new table.

But when i try to execute the following query it throws an error:-

CREATE EXTERNAL TABLE demo2 like testTable STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler' TBLPROPERTIES('es.nodes' = '10.109.91.180', 'es.port' ='9220','es.resource' = 'testES/demo','es.index.auto.create' = 'true');

FULL STACKTRACE :-

INFO : Compiling command(queryId=hive_20171012061313_6a8456fa-5b8d-444c-a94f-4d0b9cc45085): CREATE EXTERNAL TABLE demo2 like testTable STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler' TBLPROPERTIES('es.nodes' = '10.109.91.180', 'es.port' ='9220','es.resource' = 'testES/demo','es.index.auto.create' = 'true');
INFO : Semantic Analysis Completed
INFO : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
INFO : Completed compiling command(queryId=hive_20171012061313_6a8456fa-5b8d-444c-a94f-4d0b9cc45085); Time taken: 0.114 seconds
INFO : Executing command(queryId=hive_20171012061313_6a8456fa-5b8d-444c-a94f-4d0b9cc45085): CREATE EXTERNAL TABLE demo2 like testTable STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler' TBLPROPERTIES('es.nodes' = '10.109.91.180', 'es.port' ='9220','es.resource' = 'testES/demo','es.index.auto.create' = 'true');
INFO : Starting task [Stage-0:DDL] in serial mode
ERROR : FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. null
INFO : Completed executing command(queryId=hive_20171012061313_6a8456fa-5b8d-444c-a94f-4d0b9cc45085); Time taken: 0.03 seconds
Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. null (state=08S01,code=1)

So what should i do to achieve my objective. Is there a separate way of doing what i want to do, or is there something which i am missing out here

Again, that error message from Hive is not helpful. You'll need to include the logs from the hive server and job executors to find the root issue.

Copying the table information is probably not a good idea, considering that each table you create will always point to the exact same instance of data on Elasticsearch.

I understand, actually it's run on remote servers, and we don't have that much privileges to access the logs. Basically my only concern is whether i can run a query like = " CREATE EXTERNAL TABLE as SELECT * from DemoTable STORED BY "org.elasticsearch.hadoop.hive.EsStorageHandler" TBLPROPERTIES(...) ; ".

This will basically allow me to avoid specifying column name and types and will pickup from an existing table. The reason why i require this is to avoid writing 100 columns. Currently these type of queries are supported by EXTERNAL NATIVE TABLES< but since this is now being stored as external non-native table, i am not sure as how to achieve my target of using existing table schema while creation of table.
It would be a lot helphul if you could provide a workaround for this or route me towards correct person who might be better able to understand my issue and resolve it.

Thanks

Any clues, regarding my question ? Btw, all the errors have been resolved only thing left is using existing table schema while creating a new one, so as to avoid manually defining schema for 100 + columns. Is there a way to do this for non-native tables ?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.