无法描述使用avro serde创建的配置单元表

w6lpcovy  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(423)

我用avro serde创建了一个配置单元表。下面是我从一个网站复制来创建我的表的代码。

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

ut6juiuv1#

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

相关问题