我对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
文件存在并且已经包含架构?
2条答案
按热度按时间de90aj5v1#
你能试着这样做吗?
更多信息请点击此处https://cwiki.apache.org/confluence/display/hive/avroserde
1szpjjfi2#
创建外部配置单元表
orders_sqoop
从给定的avro模式文件和avro数据文件:以上
create table
命令成功执行并创建orders_sqoop
table。验证下表结构:
上表按预期创建。