gpt4 book ai didi

hadoop - 配置单元执行错误

转载 作者:可可西里 更新时间:2023-11-01 16:42:39 25 4
gpt4 key购买 nike

我是 avro 和 hive 的新手,在学习它的过程中我有些困惑。使用

tblproperties('avro.schema.url'='somewhereinHDFS/categories.avsc')

如果我像这样运行这个create命令

create table categories (id Int , dep_Id Int , name String) 
stored as avrofile
tblproperties('avro.schema.url'=
'hdfs://quickstart.cloudera/user/cloudera/data/retail_avro_avsc/categories.avsc')

但为什么我要在上面的命令中使用 id Int, dep_Id Int,即使我给出的是包含完整模式的 avsc 文件。

create table categories stored as avrofile
tblproperties('avro/schema.url'=
'hdfs://quickstart.cloudera/user/cloudera/data/retail_avro_avsc/categories.avsc')

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. 
java.lang.RuntimeException: MetaException(message:org.apache.hadoop.hive.serde2.SerDeException
Encountered AvroSerdeException determining schema.
Returning signal schema to indicate problem:
Neither avro.schema.literal nor avro.schema.url specified,
can't determine table schema)

为什么即使存在 avsc 文件并且它已经包含架构,hive 仍需要指定架构?

最佳答案

你可以尝试这样做吗?

CREATE TABLE categories
ROW FORMAT SERDE
'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
STORED AS INPUTFORMAT
'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'
TBLPROPERTIES (
'avro.schema.url'='http://schema.avsc');

更多信息在这里 https://cwiki.apache.org/confluence/display/Hive/AvroSerDe

关于hadoop - 配置单元执行错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39315385/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com