1.背景
大部分同学可能不会用hbase ,或者用hbase 不习惯,但是对sql 却很熟悉,比如要统计表的记录数,用sql 可能知道怎么写,用hbase 可能不知道,或者知道但是很慢,性能有问题等,这时我们可以通过hive 建立与hbase 表的关联关系没映射hbase 表到hive。
2.建hive表
2.1 hbase 表
hbase 已存在product 表三个列簇EXT(id ,desc ),computer(name,price),food (name ,price)没个列簇有多个列
hbase(main):007:0> desc 'product'
Table product is ENABLED
product
COLUMN FAMILIES DESCRIPTION
{NAME => 'EXT', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}
{NAME => 'computer', BLOOMFILTER => 'ROW', VERSIONS => '5', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}
{NAME => 'food', BLOOMFILTER => 'ROW', VERSIONS => '7', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE',