【问题标题】:Cannot validate serde : org.openx.data.jsonserde.jsonserde无法验证 serde:org.openx.data.jsonserde.jsonserde
【发布时间】:2014-10-30 03:02:35
【问题描述】:

我编写了这个查询来在 hive 上创建一个表。我的数据最初是 json 格式,所以我已经下载并构建了 serde 并添加了它运行所需的所有 jar。但我收到以下错误:

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

查询:

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;

【问题讨论】:

  • 您能找到任何解决此错误的方法吗?我有同样的问题,我不知道为什么。

标签: java json hadoop hive


【解决方案1】:

我也遇到过这个问题。就我而言,我设法通过在 hive 命令提示符处添加 json-serde-1.3.7-SNAPSHOT-jar-with-dependencies.jar 来解决此问题,如下所示:

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

【讨论】:

  • 每次打开 Hive 提示查询此表时,都必须再次运行第 6 步(ADD JAR /usr/local/Hive-JSON-Serde/....)。有没有我可以更改为每次自动加载的配置?
  • 要自动加载它,请使用 ~/.hiverc 文件。
  • 似乎结构发生了变化,我收到此错误 javac: directory not found: /home/hadoop/JsonSerDe/Hive-JSON-Serde/json/target/classes
【解决方案2】:

您必须使用 maven 构建克隆的项目!

mvn 安装 在目录 /path/directory/Hive-JSON-Serd 我们在 /usr/local

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多