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', 'scan.startup.mode' = 'latest-offset', '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', 'scan.startup.mode' = 'latest-offset', 'properties.bootstrap.servers' = 'localhost:9092', 'format' = 'canal-json' ); flink 查询语句 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 插入语句 insert into base values (1, 'beijing'); insert into stuff values (1, 1, 'zz'); flink 结果 <http://apache-flink.147419.n8.nabble.com/file/t858/2020-08-13_15-12-36_%E7%9A%84%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE.png> mysql 执行同样的查询的结果: +------+------+----------+------+ | s_id | b_id | location | name | +------+------+----------+------+ | 1 | 1 | beijing | zz | +------+------+----------+------+ 1 row in set (0.01 sec) 而且有时候连结果正确的行都不会出现,只会出现含 null 的行。 求助大家。。。 -- Sent from: http://apache-flink.147419.n8.nabble.com/ |
可以把原始的计算结果打印出来,执行 set execution.result-mode=changelog
(如果source有delete消息,可能会出现null值) LittleFall <[hidden email]> 于2020年8月13日周四 下午3:33写道: > 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', > 'scan.startup.mode' = 'latest-offset', > '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', > 'scan.startup.mode' = 'latest-offset', > 'properties.bootstrap.servers' = 'localhost:9092', > 'format' = 'canal-json' > ); > > flink 查询语句 > 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 插入语句 > insert into base values (1, 'beijing'); > insert into stuff values (1, 1, 'zz'); > > flink 结果 > < > http://apache-flink.147419.n8.nabble.com/file/t858/2020-08-13_15-12-36_%E7%9A%84%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE.png> > > > mysql 执行同样的查询的结果: > +------+------+----------+------+ > | s_id | b_id | location | name | > +------+------+----------+------+ > | 1 | 1 | beijing | zz | > +------+------+----------+------+ > 1 row in set (0.01 sec) > > > 而且有时候连结果正确的行都不会出现,只会出现含 null 的行。 > > 求助大家。。。 > > > > > > -- > Sent from: http://apache-flink.147419.n8.nabble.com/ > |
In reply to this post by LittleFall
本问题最后可以归结到这个问题: 请问在 flink sql 中建立的多张表应当怎样分辨接收 kafka 传来的 canal-json?
<http://apache-flink.147419.n8.nabble.com/flink-sql-kafka-canal-json-td6040.html#a6081> 并且已经解决。 谢谢你的帮助 -- Sent from: http://apache-flink.147419.n8.nabble.com/ |
Free forum by Nabble | Edit this page |