SuperCoder
SuperCoder

Reputation: 849

Error while creating external table in Hive using EsStorageHandler

I am facing an error while creating an External Table to push the data from Hive to ElasticSearch.

What I have done so far:

1) Successfully set up ElasticSearch-1.4.4 and is running.

2) Successfully set up Hadoop1.2.1, all the daemons are up and running.

3) Successfully set up Hive-0.10.0.

4) Configured elasticsearch-hadoop-1.2.0.jar in both Hadoop/lib and Hive/lib as well.

5) Successfully created few internal tables in Hive.

Error coming when executing following command:

CREATE EXTERNAL TABLE drivers_external (
    id BIGINT, 
    firstname STRING, 
    lastname STRING, 
    vehicle STRING, 
    speed STRING) 
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'                    
TBLPROPERTIES('es.nodes'='localhost','es.resource' = 'drivers/driver');

Error is:

Failed with exception org.apache.hadoop.hive.ql.metadata.HiveException: Error in loading storage handler.org.elasticsearch.hadoop.hive.EsStorageHandler FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

Any Help!

Upvotes: 1

Views: 1487

Answers (1)

SuperCoder
SuperCoder

Reputation: 849

Finally found the resolution for it...

1) The "elasticsearch-hadoop-1.2.0.jar" jar I was using was bugged one. It didn't have any hadoop/hive packages inside it. (Found this jar on internet and just downloaded it).

Now replaced it by jar from Maven repository "elasticsearch-hadoop-1.3.0.M1.jar".

2) The class "org.elasticsearch.hadoop.hive.**EsStorageHandler**" has been renamed in new elasticsearch jar as "org.elasticsearch.hadoop.hive.**ESStorageHandler**". Note that capital 'S' in 'ES'.

So the new hive command to create External table is :

CREATE EXTERNAL TABLE drivers_external (
       id BIGINT, 
       firstname STRING, 
       lastname STRING, 
       vehicle STRING, 
       speed STRING) 
STORED BY 'org.elasticsearch.hadoop.hive.ESStorageHandler'
TBLPROPERTIES('es.nodes'='localhost','es.resource' = 'drivers/driver');

It Worked!

Upvotes: 1

Related Questions