我正在尝试根据示例创建具有.avcs定义的表:
https://cwiki.apache.org/confluence/display/Hive/AvroSerDe#AvroSerDe-Useavro.schema.url
CREATE TABLE as_avro
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'='file:///path/to/the/schema/test_serializer.avsc' );
所以我正在尝试运行命令
CREATE external TABLE test2.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'='hdfs:///user/cloudera/METADATA/categories.avcs'
--'avro.schema.url'='file:///user/cloudera/METADATA/categories.avcs'
--'avro.schema.url'='file:///user/hive/warehouse/export10/METADATA/categories.avcs'
'avro.schema.url'='hdfs:///user/hive/warehouse/export10/METADATA/categories.avcs' )
我尝试了所有已评论的变体。但是我总是得到
Error while processing statement: 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: Unable to read schema from given path: file:///user/hive/warehouse/export10/METADATA/categories.avcs)
权限应该可以。
[cloudera@quickstart ~]$ hadoop fs -ls /user/cloudera/METADATA/categories.avsc
-rwxrwxrwx 1 cloudera cloudera 594 2019-05-18 10:54 /user/cloudera/METADATA/categories.avsc
有什么办法解决这个问题吗?