Link multi stream join

Time:2020-11-21

Multi stream join

The semantics of the real-time computed join and the traditional batch join are consistent, both of which are used to link the two tables. The difference is that the real-time calculation links two dynamic tables, and the result of the connection is also dynamically updated to ensure that the final result is consistent with the batch result.

Scene description

The order table is dynamically associated with the commodity table, and the associated field is commodity ID. the associated wide table is output. The source table data example is shown below.

Order form:
Link multi stream join

Commodity list:
Link multi stream join

--Multi stream join

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

-- moxian

--The semantics of the real-time computed join and the traditional batch join are consistent, both of which are used to link the two tables. The difference is that the real-time calculation links two dynamic tables, and the result of the connection is also dynamically updated to ensure that the final result is consistent with 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 represents static, and the dynamic table joins the static table