【发布时间】:2016-09-04 09:17:10
【问题描述】:
我是 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 也需要指定架构?
【问题讨论】:
标签: hadoop avro apache-hive