0
点赞
收藏
分享

微信扫一扫

实现impala对HBase数据的查询

E_topia 2022-07-18 阅读 22


impala hive hbase 整合
hbaseala hive hbase 整合
hbase
在这里插入图片描述

1、habse 创建表
create 'test_info', 'info' 表名test_info 列族: info
2.hive中创建外部表 不支持impala

CREATE EXTERNAL TABLE sho.test_info(
user_id string,
user_type tinyint,
gender string,
birthday string)
ROW FORMAT SERDE 'org.apache.hadoop.hive.hbase.HBaseSerDe'
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key, info:user_type, info:gender, info:birthday")
TBLPROPERTIES("hbase.table.name" = "test_info");

hbase中的RowKey为 user_id ,其余的为列族 info:列名

3.同步元数据 修改完hive表后也要同步元数据

INVALIDATE METADATA;
1
同步hive的Metastore中的元数据

注意:
1.ROW FORMAT SERDE ‘org.apache.hadoop.hive.hbase.HBaseSerDe’
STORED BY ‘org.apache.hadoop.hive.hbase.HBaseStorageHandler’
WITH SERDEPROPERTIES 是严格区分大小写的
2.如果要改变test_info的字段,则只需删除test_info表,然后重建即可。
3.新老test_info的字段名个数可以不同,甚至表名都可以不同
4.重建若想要查询之前已有的数据,需保证字段名字一样。
5.insert into会自动覆盖相同字段名字的数据
6.用hive、impala每次查出的都是最新的数据



举报

相关推荐

0 条评论