在hive中创建表时无法确定架构

时间:2015-07-22 11:28:42

标签: hadoop hive hdfs avro

我正在尝试使用以下查询创建一个配置单元

CREATE EXTERNAL TABLE IF NOT EXISTS test_table PARTITIONED BY(loaded_stage_date BIGInt) 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' location 'hdfs:///dev/data/warehouse/clean/abc/source/tao/bdo/test_table' TBLPROPERTIES ('avro.schema.url'='hdfs:///dev/data/warehouse/clean/abc/source/tao/dbo/test_table/.metadata/test_table.avsc');

表模式如下:

{
  "type":"record",
  "name":"test",
  "namespace":"com.abc.def.jhon",
  "doc":"test",
  "fields": [{
                                                "name":"ID",
                                                "type":"string"
                } ,{
                                                "name":"LOGIN_ID",
                                                "type":"string"
                } ,{
                                                "name":"ENAME",
                                                "type":"string"
                } ,{
                                                "name":"STATE",
                                                "type":"string"
                } ,{
                                "name":"LOCAL_START_TIME",
                                "type":"long"
                } ,{
                                "name":"LOCAL_STOP_TIME",
                                "type":"long"
                } ,{
                                "name":"UTC_START_TIME",
                                "type":"long"
                } ,{
                                "name":"UTC_STOP_TIME",
                                "type":"long"
                } ,{
                                "name":"NDX",
                                "type":"long"
                } ,{
                                "name":"STATE_INDX",
                                "type":"float"
                } ,{
                                "name":"GUID",
                                "type":"string"
                } ,{
                                "name":"DURATION_SECONDS",
                                "type":"bigint"
                                  }]
}

我收到以下错误:

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
loaded_stage_date       bigint
  

但是,当我在avsc(架构文件)文件中将列类型指定为 int 而不是 bigint 时,它运行正常。

0 个答案:

没有答案