我正在用 table 加入一个流 . 连接的结果只是部分成功 . 某些值已准确填充,而其他值为null . 我检查以确保表和流中都存在值,并且用于连接的列是两者的关键 .
我正在使用汇编来加载使用jdbc从MSSQL中的表中读取的主题 .
然后我使用KSQL从相应的主题创建流和表,并且数据都是JSON格式 .
表中缺失数据的时间戳早于流的时间戳 .
create stream casecode_contract_stream as select ct.projectid, ct.casecode, cs.isTrue from contract_stream cs left join casecode_table ct on cs.projectid = ct.projectid;
select * from casecode_contract_stream limit 1;
1532034321292 | 706083 | null | null | true
ksql> select * from casecode_contract_stream where casecode is not null limit 1;
1532034321292 | 705147 | 705147 | data1 | true
select * from casecode_table where projectid = 705147;
1532033878462 | 705147 | 705147 | data1
select * from casecode_table where projectid = 706083;
1532033878463 | 706083 | 706083 | data2
select * from contract_stream where projectid = 705147;
1532034321292 | 705147 | 705147 | true
select * from contract_stream where projectid = 706083;
1532034321292 | 706083 | 706083 | true
有什么建议?
1 回答
结果取决于(非确定性)处理顺序 . 这是一个已知问题,正在进行中,以使处理顺序更具确定性 .
在将记录添加到表侧之前,可能会处理来自流侧的记录 . 对于这种情况,当您指定左连接时,流记录将与NULL连接 .