关于phoenix构建hbase视图,更新hbase表后,视图表是否更新的验证

1:创建表

create 'MY_TABLE', 'CF1','CF2'

2:在hbase上插入一条数据

put 'MY_TABLE','1' ,'CF1:V1', 'uwo1'

3:在phoenix上创建视图

create view MY_TABLE (PK  varchar primary key, CF1.V1 varchar, CF2.V2 varchar, CF1.V3 varchar);

4:查询phoenix的视图

0: jdbc:phoenix:df1:2181> select * from MY_TABLE;
+-----+-------+-----+-----+
| PK  |  V1   | V2  | V3  |
+-----+-------+-----+-----+
| 1   | uwo1  |     |     |
+-----+-------+-----+-----+

5:向hbase在插入一条数据

put 'MY_TABLE','1' ,'CF1:V3', '10'

此时hbase中有2条数据,然后再次插入phoenix的视图:

0: jdbc:phoenix:df1:2181> select * from MY_TABLE;
+-----+-------+-----+-----+
| PK  |  V1   | V2  | V3  |
+-----+-------+-----+-----+
| 1   | uwo1  |     | 10  |
+-----+-------+-----+-----+
1 row selected (0.018 seconds)

仍然只有1条数据。说明:phoenix构建hbase视图,更新hbase表后,视图表是不会更新的

posted @ 2019-07-09 14:27  niutao  阅读(1014)  评论(1编辑  收藏  举报