Hive不显示HBase表中的数据

时间:2015-05-07 08:31:30

标签: hive hbase

我创建了下面的HBase表并插入了一条记录。

hbase(main):001:0> create 'table3', 'col_fam1', 'col_fam2', 'col_fam3'
0 row(s) in 1.8280 seconds

hbase(main):008:0> put 'table3', 'row1', 'col_fam1:c11', 'val11'
0 row(s) in 0.0980 seconds

hbase(main):009:0> put 'table3', 'row1', 'col_fam1:c12', 'val12'
0 row(s) in 0.0060 seconds

hbase(main):010:0> put 'table3', 'row1', 'col_fam2:c21', 'val21'
0 row(s) in 0.0070 seconds

hbase(main):011:0> put 'table3', 'row1', 'col_fam3:c31', 'val31'
0 row(s) in 0.0090 seconds

当我试图查看HBase表中的数据时,它显示正确。

hbase(main):029:0> scan 'table3'
ROW                                  COLUMN+CELL                                                                                               
 row1                                column=col_fam1:c11, timestamp=1430986499437, value=val11                                                 
 row1                                column=col_fam1:c12, timestamp=1430986509448, value=val12                                                 
 row1                                column=col_fam2:c21, timestamp=1430986519155, value=val21                                                 
 row1                                column=col_fam3:c31, timestamp=1430986527751, value=val31                                                 
1 row(s) in 0.0390 seconds

接下来我创建了一个HIVE表

hive> create external table hive_hbase_table3 (
    key string, 
    col11 string, 
    col12 string, 
    col21 string, 
    col31 string
    ) 
    stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' 
    with serdeproperties (
      "hbase.columns.mapping" = ":key,col_fam1:col11, col_fam1:col12, col_fam2:col21, col_fam3:col31"
    ) tblproperties(
      "hbase.table.name" = "table3"
    );
OK
Time taken: 0.996 seconds

但是当我从HIVE表中选择时,没有找到任何行。理想情况下应该选择一行。

hive> select * from hive_hbase_table3;
OK
Time taken: 0.718 seconds

有人可以告诉我这里的错误吗?

0 个答案:

没有答案