Hi community,

Temporal table join in Flink is a powerful feature, especially processing
time temporal table join, which is very commonly used in production.
However, the syntax of temporal table join only supports 'FOR SYSTEM_TIME
AS OF' left table's time attribute field currently. e.g.,

```
SELECT *
FROM Orders AS o
JOIN Products FOR SYSTEM_TIME AS OF o.proctime AS p
ON o.productId = p.productId
```

That means the users have to explicitly define a the proctime field either
in the left table DDL or the left temporary view, which is inconvenient to
use.

>> Preferred solution
I think maybe we can add a pseudo-column `PROCTIME` (or `_PROCTIME` to
avoid conflict) to the table by default, just like the pseudo-column of
classic database, e.g., `ROWID` in Oracle. In this way, we can use Temporal
table join very conveniently.

>> Less elegant solution
Actually, we have another simpler solution, i.e., enrich the syntax for
temporal table join to support 'FOR SYSTEM_TIME AS OF PROCTIME()'. It is
also very convenient, However, the `PROCTIME()` in 'FOR SYSTEM_TIME AS OF
PROCTIME()' is ambiguous, because it cannot tell where the version time of
temporal table comes from, left table or right table? The former is what we
want. So I think this solution is not preferred.

Looking forward to your feedback~

Best,
Shuo

Reply via email to