Skip to content

Commit c83dc91

Browse files
author
dapeng
committed
hbase 详细示例
1 parent 85285e2 commit c83dc91

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/plugin/hbaseSide.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ CREATE TABLE sideTable (
9898
```
9999
hbase(main):002:0> scan 'testFlinkStreamSql'
100100
ROW COLUMN+CELL
101-
0 column=wtz:info, timestamp=1587089266719, value=hadoop
102-
0 column=wtz:message, timestamp=1587089245780, value=hbase
103-
1 column=wtz:info, timestamp=1587088818432, value=flink
104-
1 column=wtz:message, timestamp=1587088796633, value=dtstack
105-
2 column=wtz:info, timestamp=1587088858564, value=sql
106-
2 column=wtz:message, timestamp=1587088840507, value=stream
101+
cfcd208495d565ef66e7dff9f98764dazhangsantest column=wtz:info, timestamp=1587089266719, value=hadoop
102+
cfcd208495d565ef66e7dff9f98764dazhangsantest column=wtz:message, timestamp=1587089245780, value=hbase
103+
c4ca4238a0b923820dcc509a6f75849blisitest column=wtz:info, timestamp=1587088818432, value=flink
104+
c4ca4238a0b923820dcc509a6f75849blisitest column=wtz:message, timestamp=1587088796633, value=dtstack
105+
c81e728d9d4c2f636f067f89cc14862cwangwutest column=wtz:info, timestamp=1587088858564, value=sql
106+
c81e728d9d4c2f636f067f89cc14862cwangwutest column=wtz:message, timestamp=1587088840507, value=stream
107107
```
108108
在hbase中,rowKey是一个二进制码流,可以为任意字符串,flinkStreamSql读取rowKey并通过rowKey唯一确定数据,对rowKey没有任何限制,对rowKey可选择的构造包括 md5(alias + alias), '常量',也可以它们的自由组合。
109109
在本次案例中,rowKey为了简单,设置成了"0,1,2"这样的数值型字符,若有必要,也可以设计得更为复杂。
@@ -138,7 +138,7 @@ CREATE TABLE MyResult(
138138
CREATE TABLE sideTable (
139139
wtz:message varchar as message,
140140
wtz:info varchar as info ,
141-
PRIMARY KEY (md5(key1) + key2),
141+
PRIMARY KEY (md5(rowkey1) + rowkey2 + 'test'),
142142
PERIOD FOR SYSTEM_TIME
143143
) WITH (
144144
type = 'hbase',
@@ -166,6 +166,6 @@ into
166166
MyTable a
167167
left join
168168
sideTable b
169-
on a.id=b.key1 and a.xx = b.key2;
169+
on a.id=b.rowkey1 and a.name = b.rowkey2;
170170
```
171171

0 commit comments

Comments
 (0)