我有一个hbase表,rowkey看起来像这样。
08:516485815:2013 1
06:260070837:2014 1
00:338289200:2014 1
我使用以下查询创建一个蜂巢链接表。
create external table hb
(key string,value string)
stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
with serdeproperties("hbase.columns.mapping"=":key,e:-1")
tblproperties("hbase.table.name"="hbaseTable");
当我查询表时,我得到以下结果
select * from hb;
08:516485815 1
06:260070837 1
00:338289200 1
这对我来说很奇怪。为什么SERDE无法映射HBase密钥的全部内容?蜂巢表丢失了第二个"
"之后的所有内容有人面临类似的问题吗?
我尝试通过在HBase 1.1.2和Hive 1.2.1000上重新创建您的方案,它可以按预期工作,我可以从Hive 中获得整个Rowkey。
hbase> create 'hbaseTable','e'
hbase> put 'hbaseTable','08:516485815:2013','e:-1','1'
hbase> scan 'hbaseTable'
ROW COLUMN+CELL
08:516485815:2013 column=e:-1, timestamp=1519675029451, value=1
1 row(s) in 0.0160 seconds
我有08:516485815:2013作为Rowkey和我创建了Hive Table
hive> create external table hb
(key string,value string)
stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
with serdeproperties("hbase.columns.mapping"=":key,e:-1")
tblproperties("hbase.table.name"="hbaseTable");
hive> select * from hb;
+--------------------+-----------+--+
| hb.key | hb.value |
+--------------------+-----------+--+
| 08:516485815:2013 | 1 |
+--------------------+-----------+--+
您一旦确保您的hbase table rowkey在> sectect之后具有数据:。