2014-10-30 144 views
6

我已經編寫了此查詢以在配置單元上創建表。我的數據最初是json格式,所以我下載並構建了serde並添加了運行所需的所有jar。但我發現了以下錯誤:無法驗證serde:org.openx.data.jsonserde.jsonserde

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Cannot validate serde: org.openx.data.jsonserde.JsonSerDe 

QUERY:

create table tip(type string, 
    text string, 
    business_id string, 
    user_id string, 
    date date, 
    likes int) 
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe' 
WITH SERDEPROPERTIES("date.mapping"="date") 
STORED AS TEXTFILE; 
+0

你會發現這個錯誤的任何解決方案。我有同樣的問題,我不知道爲什麼。 – xxlali 2015-08-07 06:02:03

回答

5

我也遇到了這個問題。就我而言,我設法通過增加json-serde-1.3.7-SNAPSHOT-jar-with-dependencies.jarhive命令提示符來解決這個問題,如下圖所示:

hive> ADD JAR /usr/local/Hive-JSON-Serde/json-serde/target/json-serde-1.3.7-SNAPSHOT-jar-with-dependencies.jar; 

下面是我按照在Ubuntu 14.04的步驟:

1. Fire up Linux terminal and cd /usr/local 

2. sudo git clone https://github.com/rcongiu/Hive-JSON-Serde.git 

3. sudo mvn -Pcdh5 clean package 

4. The serde file will be in 
    /usr/local/Hive-JSON-Serde/json-serde/target/json-serde-1.3.7-SNAPSHOT-jar-with-dependencies.jar 

5. Go to hive prompt and ADD JAR file as shown in Step 6. 

6. hive> ADD JAR /usr/local/Hive-JSON-Serde/json-serde/target/json-serde-1.3.7- SNAPSHOT-jar-with-dependencies.jar; 

7. Now create hive table from hive> prompt. At this stage, Hive table should be created successfully without any error. 

Hive版本:1.2.1

Hadoop版本:2.7.1

參考:Hive-JSON-Serde

+0

每次打開Hive提示來查詢此表時,我都必須再次運行第6步(ADD JAR/usr/local/Hive-JSON-Serde/....)。是否有可以更改的配置以每次都自動加載? – 2016-11-08 15:17:03

+0

要自動加載它,請使用〜/ .hiverc文件。 – 2017-05-04 18:09:09

+0

似乎結構已經發生變化,我得到這個錯誤javac:找不到目錄:/ home/hadoop/JsonSerDe/Hive-JSON-Serde/json/target/classes – 2018-01-26 01:45:25