stream-processing-with-apache-flink icon indicating copy to clipboard operation
stream-processing-with-apache-flink copied to clipboard

Lookup join example is potentially wrong

Open xjmdoo opened this issue 1 year ago • 1 comments

Hi,

I'm going through the book and I think the lookup join query is incorrect.

SELECT
    transactionId,
    t.accountId,
    t.eventTime_ltz,
    TO_TIMESTAMP_LTZ(updateTime, 3) AS updateTime,
    type,
    amount,
    balance,
    districtId,
    frequency
FROM transactions AS t
    JOIN accounts FOR SYSTEM_TIME AS OF t.eventTime_ltz AS a
    ON t.accountId = a.accountId;

As it is mentioned in the intro, a processing time attribute is required, however, in the example an event time field is used. On the Flink Dashboard it is also visible that the executed query is doing a temporal join. Switching to a field which is defined as PROCTIME() turns the query into a lookup join.

xjmdoo avatar Feb 21 '24 22:02 xjmdoo

@xjmdoo thanks for highlighting this. For a lookup join the table needs to have a processing time attribute and the other table to be backed by a lookup source connector.

Will try and update ASAP

polyzos avatar Feb 22 '24 08:02 polyzos