Support Questions

Find answers, ask questions, and share your expertise

Hive - Select working in shell but not in Hue

avatar
Champion Alumni

Hello,

 

I created a json table in Hive and then I loaded data from a folder into it. The query is sucessful. 

ADD JAR /data/hive/jars/json-serde-1.3-jar-with-dependencies.jar;
Select * from myTable

 However, when I try to access the table I get an error:

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer

When I try to access the same table with the same query in Hive shell I do not get any error and I can acess the table.

 

Where should I look for? IS there any other jar that I have to add in order to make this work in beeswax(hue)? 

 

Thank you!

GHERMAN Alina
1 ACCEPTED SOLUTION

avatar
Champion Alumni

In the select there was a ',' missing. 

GHERMAN Alina

View solution in original post

14 REPLIES 14

avatar
Champion Alumni

In the select there was a ',' missing. 

GHERMAN Alina

avatar
Super Guru
Awesome 🙂

avatar
Explorer

hi, Romain, 

 

  I am having the same issue. I just installed CDH5.4 and use json-serde-1.3-jar-with-dependencies.jar to create external table. 

 

CREATE EXTERNAL TABLE IF NOT EXISTS mytable2 (field1 string, field2 int, field3 string, field4 double) ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe' WITH SERDEPROPERTIES ( "ignore.malformed.json" = "true") LOCATION '/tmp/mytable2';

 

The testing data is: 

{"field1":"data1","field2":100,"field3":"more data1","field4":123.001}

 

In Hive CLI I am able to query the table. But when I use beeline or Hue interface, I got the same error: 

Error: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer (state=,code=0)

 

I have copied the json-serde-1.3-jar-with-dependencies.jar to the following directory but it still does not work:

/var/opt/cloudera/parcels/CDH/lib/hive/lib/

/var/opt/cloudera/parcels/CDH/lib/hadoop/lib/

/var/opt/cloudera/parcels/CDH/lib/hadoop-mapreduce/lib/

/var/opt/cloudera/parcels/CDH/lib/hadoop-0.20-mapreduce/lib/

 

  Do you know the reason? 

 

thanks

Bin

 

avatar
Super Guru
Did you load the jar in the editor?

A bit like http://gethue.com/hadoop-tutorial-hive-udf-in-1-minute/



avatar
New Contributor

Hi Romainr,
I am using cdh5.5.2 with Hue 3.9.0.
As part of Hive Config, I have set Hive Auxiliary JARs Directory as '/usr/lib/hive/lib' which contains the Json Serde Jar.
Further I have -
1) Using Hive Command Line - Created a table in Hive, with [ ROW FORMAT SERDE 'com.cloudera.hive.serde.JSONSerDe' ]
2) Loaded sample data to Hive table
3) Ran 'select * tableName;' successfully.
4) When I ran the same in < Hue - Hive Editor >, I am facing the following error-
FAILED: RuntimeException MetaException(message:java.lang.ClassNotFoundException Class com.cloudera.hive.serde.JSONSerDe not found)

Can you please advise ?