Flink multi stream join

Time:2021-6-14

Multi stream join

The semantics of real-time calculation join is consistent with that of traditional batch join, which is used to connect two tables. The difference is that the real-time calculation is related to two dynamic tables, and the result of the connection will be updated dynamically to ensure the consistency between the final result and the batch result.

Scene description

The order table is dynamically associated with the commodity table. The associated field is the commodity ID. the associated wide table is output. The sample data of the source table is shown below.

Order form:
Flink multi stream join

Commodity list:
Flink multi stream join

--Multi stream join

-- 2019-10-22 11:42:04

-- moxian

--The semantics of real-time calculation join is consistent with that of traditional batch join, which is used to connect two tables. The difference is that the real-time calculation is related to two dynamic tables, and the result of the connection will be updated dynamically to ensure the consistency between the final result and the batch result.

INSERT INTO mx_stream2stream

SELECT 

 o.rt as rowtime,

 o.productId as productId,

 o.orderId as orderId,

 o.units as units,

 p.name as category,

 cast(p.unitPrice as int) as unitPrice

From orders O -- source table 1 order table

Join products P -- source table 2 product table

ON o.productId = p.productId;

be careful:

  1. The order table is dynamic, the product is static, and the dynamic table joins the static table