在 mysql 上的建表语句:
use test;
create table base (
id int primary key,
location varchar(20)
);
create table stuff(
id int primary key,
b_id int,
name varchar(20)
);
在 flink sql client 中的建表语句:
create table base (
id int primary key,
location varchar(20)
)WITH (
'connector' = 'kafka',
'topic' = 'example',
'properties.group.id' = 'testGroup',
'properties.bootstrap.servers' = 'localhost:9092',
'format' = 'canal-json'
);
create table stuff(
id int primary key,
b_id int,
name varchar(20)
)WITH (
'connector' = 'kafka',
'topic' = 'example',
'properties.group.id' = 'testGroup',
'properties.bootstrap.servers' = 'localhost:9092',
'format' = 'canal-json'
);
在 flink sql client 中执行查询:
select distinct stuff.id s_id, base.id b_id, base.location, stuff.name
from stuff inner join base
on stuff.b_id = base.id;
在 mysql 中插入数据:
mysql> insert into base values (1, "beijing");
Query OK, 1 row affected (0.02 sec)
mysql> insert into stuff values (1, 1, "zz");
Query OK, 1 row affected (0.01 sec)
结果如附图所示。
而在 mysql 中执行查询:
mysql> select distinct stuff.id s_id, base.id b_id, base.location,
stuff.name
-> from stuff inner join base
-> on stuff.b_id = base.id;
+------+------+----------+------+
| s_id | b_id | location | name |
+------+------+----------+------+
| 1 | 1 | beijing | zz |
+------+------+----------+------+
1 row in set (0.00 sec)
请问各位,为什么会导致结果不正确呢?而且有时连正确的那行都没有,只有一行含 null 的。
--
Sent from: http://apache-flink.147419.n8.nabble.com/