Mark Nuttall
11/15/2024, 11:59 AMSELECT *
FROM Orders o, Shipments s
WHERE o.id = s.order_id
AND o.order_time BETWEEN s.ship_time - INTERVAL '4' HOUR AND s.ship_time
the word JOIN does not appear - so there's nowhere to say LEFT JOIN. This syntax allows for inner joins only. In Ververica's Cookbook we see syntax of the form,
SELECT [params]
FROM orders o
JOIN shipments s ON o.id = s.order_id
WHERE
o.order_time BETWEEN s.shipment_time - INTERVAL '3' DAY AND s.shipment_time;
but changing JOIN to LEFT JOIN does nothing - you still get an inner join. The only place I've found working syntax is in this post to the user mailing list from 2021 where we find the form,
SELECT [params]
FROM abandoned_visits av
FULL OUTER JOIN orders o
ON av.key1 = o.key1
AND av.email = o.email
AND o.ts BETWEEN av.ts - INTERVAL '30' MINUTE AND av.ts + INTERVAL '30' MINUTE
This form, [JOIN] ON [condition] AND [condition...] AND [time condition] is the only form that works - you can change FULL OUTER to LEFT and get correct left join behaviour. My questions are,
Should left interval join be possible in Flink SQL? Is it supported? Is it an oversight that the docs leave the reader unable to left, right or outer interval join? Many thanks in advance!david radley
11/21/2024, 1:41 PM