I have some scenario about ksqlDB stream join table
- I have transaction stream
CREATE STREAM USERS_DATA_PRITE007 (KEY_STRUCT STRUCT<USERID VARCHAR> KEY, USERNAME VARCHAR, AGES INTEGER ,EMAIL VARCHAR)
WITH (kafka_topic='USERS_DATA_PRITE007',value_format='AVRO', key_format='AVRO',partitions=1);
CREATE STREAM USERS_DATA_PRITE007_ST AS SELECT
KEY_STRUCT,
USERNAME,
AGES,
EMAIL
FROM USERS_DATA_PRITE007;
- I have master table
CREATE STREAM USERS_DATA_PRITE008 (KEY_STRUCT STRUCT<USERID VARCHAR> KEY, USERNAME VARCHAR, AGES INTEGER ,EMAIL VARCHAR)
WITH (kafka_topic='USERS_DATA_PRITE008',value_format='AVRO', key_format='AVRO',partitions=1);
CREATE TABLE USERS_DATA_PRITE008_TB AS SELECT
AGES,
LATEST_BY_OFFSET(USERNAME) as USERNAME,
LATEST_BY_OFFSET(EMAIL) as EMAIL
FROM USERS_DATA_PRITE008
GROUP BY AGES;
- join between stream and table using field AGES
CREATE STREAM USERS_DATA_PRITE1150_ST AS SELECT
A.AGES,
A.USERNAME as TRANSACTION_USERNAME,
B.USERNAME as MASTER_USERNAME,
B.EMAIL as MASTER_EMAIL
FROM USERS_DATA_PRITE007_ST A
LEFT JOIN USERS_DATA_PRITE008_TB B
ON A.AGES = B.AGES
EMIT CHANGES;
4.pause query of USERS_DATA_PRITE007_ST
PAUSE CSAS_USERS_DATA_PRITE007_ST_1949;
5.INSERT Transaction data with AGES = 31 and ROWTIME is 2024-05-23 03:50:21.915
INSERT INTO USERS_DATA_PRITE007 (KEY_STRUCT, USERNAME, AGES, EMAIL) VALUES (STRUCT(USERID := 'A2'), 'USER-A-3', 31, 'userA2@abc.com');
- INSERT Master data with AGES = 31 and ROWTIME is 2024-05-23 03:52:44.180
INSERT INTO USERS_DATA_PRITE008 (KEY_STRUCT, USERNAME, AGES, EMAIL) VALUES (STRUCT(USERID := 'A2'), 'USER-A-2', 31, 'u111123@abc.com');
7.RESUME query of Transaction data
RESUME CSAS_USERS_DATA_PRITE007_ST_1949;
- Select Join stream and table (USERS_DATA_PRITE1150_ST ) but have output of record
question: ksqlDB stream join table why in this scenario can trigger output of join. rowtime is not field of process timestamped? or what timestamp field for lookup join.