ekuiper icon indicating copy to clipboard operation
ekuiper copied to clipboard

Help needed - Attempting to join wildcard table with wildcard stream

Open Earbuckets opened this issue 4 years ago • 1 comments

Have an mqtt stream setup to listen for a wildcard topic +/+/Temp, and also created a table to hold the state of the topic as +/+/Setpoint. Attempting to do a join and create a rule that checks if Temp > Setpoint.

The SQL we have attempted: SELECT Temp.DEVICE as stDevice, SPTTABLE.DEVICE as spDevice from Temp LEFT JOIN SPTTable ON Temp.DEVICE = SPTTable.DEVICE GROUP BY TUMBLINGWINDOW(ss, 60)

It seems to be joining all of the Temps with the last seen Setpoint. Both stream and table are defined the same as far as structure goes, and we are attempting to join on the DEVICE which is a string. Is this possible to do with streams or tables?

Earbuckets avatar Aug 03 '21 22:08 Earbuckets

It seems to be joining all of the Temps with the last seen Setpoint

By default, the table will retain the last seen event. How many Setpoint events do you want to join? You can specify the RETAIN_SIZE propety to specify how many events to retain in the table, example as below:

CREATE TABLE demoTable (
	device STRING,
	ts BIGINT
) WITH (DATASOURCE="demoTable", RETAIN_SIZE="3");

ngjaying avatar Aug 04 '21 00:08 ngjaying

Close as inactivity

ngjaying avatar Oct 27 '22 12:10 ngjaying