Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For SQL, the default watermark emit-strategy is 'ON_PERIODICon-periodic', which can be set manually via table options and hint :

Code Block
languagesql
-- configure in table options
CREATE TABLE user_actions (
  ...
  user_action_time TIMESTAMP(3),
  WATERMARK FOR user_action_time AS user_action_time - INTERVAL '5' SECOND
) WITH (
  'scan.watermark.emit.strategy'='ON_PERIODICon-periodic',
  ...
);

-- use 'OPTIONS' hint
select ... from source_table /*+ OPTIONS('scan.watermark.emit.strategy'='ON_PERIODICon-periodic') */


If the user wants to configure the 'ON_EVENTon-event' strategy, he/she can use table options or hint like this:

Code Block
languagesql
-- configure in table options
CREATE TABLE user_actions (
  ...
  user_action_time TIMESTAMP(3),
  WATERMARK FOR user_action_time AS user_action_time - INTERVAL '5' SECOND
) WITH (   
  'scan.watermark.emit.strategy'='ON_EVENTon-event',
  'scan.watermark.emit.on-event.gap'='10000',
  ...
);

-- use 'OPTIONS' hint
select ... from source_table /*+ OPTIONS('scan.watermark.emit.strategy'='ON_EVENTon-event', 'scan.watermark.emit.on-event.gap'='10000') */


Note that the option 'scan.watermark.emit.on-event.gap' which is used to configure how many events to emit a watermark only works for 'ON_EVENTon-event' strategy,  This option is not required, the default value is 1.

...

Code Block
languagesql
-- configure in table options
CREATE TABLE user_actions (
  ...
  user_action_time TIMESTAMP(3),
  WATERMARK FOR user_action_time AS user_action_time - INTERVAL '5' SECOND
) WITH (
  'sourcescan.idle-timeout'='1min',
  ...
);

-- use 'OPTIONS' hint
select ... from source_table /*+ OPTIONS('sourcescan.idle-timeout'='1min') */

...

Code Block
languagesql
-- configure in table options
CREATE TABLE user_actions (
...
user_action_time TIMESTAMP(3),
  WATERMARK FOR user_action_time AS user_action_time - INTERVAL '5' SECOND
) WITH (
'scan.watermark.alignment.group'='alignment-group-1',
'scan.watermark.alignment.max-drift'='1min',
'scan.watermark.alignment.update-interval'='1s',
...
);

-- use 'OPTIONS' hint
select ... from source_table /*+ OPTIONS('scan.watermark.alignment.group'='alignment-group-1', 'scan.watermark.alignment.max-drift'='1min', 'scan.watermark.alignment.update-interval'='1s') */

...

All the options described above :

Code Block
languagesql
'scan.watermark.emit.strategy'='ON_EVENTon-event',
'scan.watermark.emit.on-event.gap'='10000',
'sourcescan.idle-timeout'='1min',
'scan.watermark.alignment.group'='alignment-group-1',
'scan.watermark.alignment.max-drift'='1min',
'scan.watermark.alignment.update-interval'='1s'

...