2016-09-04 5 views
0

私はavroとハイブを初めて使いました。使用方法ハイブ実行エラー

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

私は

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') 

のように、このcreateのコマンドを実行しますが、なぜ私は完全なスキーマが含まれているavscファイルを与えている場合でも、上記のコマンドでid Int, dep_Id Intを使用する必要があります。

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ファイルが存在し、それが既にスキーマが含まれている場合でも、スキーマを指定するハイブ必要はありませんか?

答えて

1

このようにしてみることはできますか?

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

関連する問題