Help Center/ AI DataLake/ Flink reference/ Enhanced Flink Features/ Flink SQL Lookup Join's Support for the PROCTIME() Syntax
Updated on 2026-11-06 GMT+08:00

Flink SQL Lookup Join's Support for the PROCTIME() Syntax

Scenario

In the Flink Lookup Join syntax, FOR SYSTEM_TIME AS OF must include the proc_time field, for example, FOR SYSTEM_TIME AS OF o.proc_time. Now, you can use PROCTIME() to replace the proc_time field in the table and directly use FOR SYSTEM_TIME AS OF PROCTIME(). The proc_time field no longer needs to be defined in the table. This is also supported by subqueries.

Usage

When configuring a Flink job, Lookup Join allows direct use of PROCTIME() to replace the proc_time field in the table.

SQL Example

CREATE TABLE kafkasource(
  order_id STRING,
  price DECIMAL(32, 2),
  currency STRING
) WITH (
  'connector' = 'kafka',
  'topic' = 'test_source',
  'properties.bootstrap.servers' = '<service-IP-address-of-Kafka-broker-instance>:<Kafka-port>',
  'properties.group.id' = 'testGroup',
  'scan.startup.mode' = 'latest-offset',
  'format' = 'csv',
  'properties.sasl.kerberos.service.name' = 'kafka',
  'properties.security.protocol' = 'SASL_PLAINTEXT',
  'properties.kerberos.domain.name' = 'hadoop.<system-domain-name>'
);
CREATE TABLE customers (id STRING, name STRING, country STRING) WITH (
  'connector' = 'jdbc',
  'url' = 'jdbc:mysql://mysqlhost:ip/customerdb',
  'table-name' = 'customers',
  'username' = 'xxxx',
  'password' = 'xxxx'
);
CREATE TABLE print (
  order_id STRING,
  price DECIMAL(32, 2),
  name STRING,
  country STRING
) WITH ('connector' = 'print');
insert into
  print
SELECT
  o.order_id,
  o.price,
  c.name,
  c.country
FROM
  kafkasource as o
  JOIN customers FOR SYSTEM_TIME AS OF PROCTIME() AS c ON o.order_id = c.id;