0

我用 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)
4

1 回答 1

1

后来我发现 avro 模式中的字段是用制表符分隔的。我在记事本中复制了代码并删除了选项卡并重新运行命令。有效!!!

于 2015-07-16T10:53:20.120 回答