无法描述使用avro serde创建的Hive表

时间:2015-07-16 10:50:27

标签: hadoop hive avro describe

我用Avro serde创建了一个Hive表。下面是我从网站上复制的代码,用于创建我的表格。

create table NEW_TABLE
     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.literal'='{
        "name": "my_record",
        "type": "record",
        "fields": [
           {"name":"boolean1", "type":"boolean"},
           {"name":"int1", "type":"int"},
           {"name":"long1", "type":"long"},
           {"name":"float1", "type":"float"},
           {"name":"double1", "type":"double"},
           {"name":"string1", "type":"string"},
           {"name": "nullable_int", "type": ["int", "null"]]}');

当我发出描述表格的命令时,我收到了以下错误:

hive> describe new_table;
OK
error_error_error_error_error_error_error       string                  from deserializer
cannot_determine_schema string                  from deserializer
check                   string                  from deserializer
schema                  string                  from deserializer
url                     string                  from deserializer
and                     string                  from deserializer
literal                 string                  from deserializer
Time taken: 0.15 seconds, Fetched: 7 row(s)

1 个答案:

答案 0 :(得分:1)

我后来发现avro架构中的字段由制表符分隔。我在记事本中复制了代码并删除了选项卡并重新运行命令。它工作!!!