【发布时间】:2019-05-04 08:16:47
【问题描述】:
我使用以下查询创建了一个分区 Hive 表
CREATE EXTERNAL TABLE `customer`(
`cid` string COMMENT '',
`member` string COMMENT '',
`account` string COMMENT '')
PARTITIONED BY (update_period string)
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://nameservice1/user/customer'
TBLPROPERTIES (
'avro.schema.url'='/user/schema/Customer.avsc')
我正在使用 map reduce 程序写入分区位置。当我使用 avro 工具读取输出文件时,它以 json 格式显示正确的数据。但是当我使用 hive 查询来显示数据时,什么都没有显示。如果我在创建表期间不使用分区字段,则这些值将显示在配置单元中。这可能是什么原因?我将 mapreduce 程序的输出位置指定为“/user/customer/update_period=201811”。
是否需要在 mapreduce 程序配置中添加任何内容来解决此问题?
【问题讨论】:
标签: hadoop hive mapreduce avro hadoop-partitioning