CREATE
STREAM IF NOT EXISTS iot_clean.stream_clean_6m
INTERVAL(5m) SLIDING(5m)
FROM iot.tsdata
PARTITION BY product_id, device_id, identifier
STREAM_OPTIONS(
PRE_FILTER(product_id in('add80ab6-95ee-583a-95b9-e6b33f6c842e','3685200d-17a5-5c89-a6e9-53e8bddea1bd'))
| MAX_DELAY(5m)
| FILL_HISTORY_FIRST('2026-01-01 00:00:00')
)
INTO iot_clean.tsdata_clean_6m
OUTPUT_SUBTABLE(
CONCAT(
'clean6min_',
REPLACE(product_id, '-', ''),
'_',
REPLACE(device_id, '-', ''),
'_',
REPLACE(identifier, '-', '')
)
)
TAGS (
product_id VARCHAR(32) AS product_id,
device_id VARCHAR(32) AS device_id,
identifier VARCHAR(64) AS identifier
)
AS
SELECT _twstart AS ts,
LAST(double_v) AS double_v,
LAST(bool_v) AS bool_v,
LAST(long_v) AS long_v,
CAST(_tlocaltime / 1000000 AS TIMESTAMP) AS insert_time
FROM %%trows;
%%trows: reference to the trigger dataset for each group in the trigger table (i.e., the set of rows that meet the current trigger condition) 这个不是触发表的相关数据么,这个跟c0 >= twstart and c0 < tend 这个差别大么