Help Center/ MapReduce Service/ Component Operation Guide (LTS)/ Using Flink/ Enterprise-Class Enhancements of Flink/ Filtering the Withdrawals Generated by the Flink SQL Dual-Stream Join
Updated on 2026-06-27 GMT+08:00

Filtering the Withdrawals Generated by the Flink SQL Dual-Stream Join

This section applies only to MRS 3.6.0-LTS and later.

Scenarios

When configuring a Flink job, you can filter the withdrawals generated by the dual-stream join. The -D +U -U of the source operator is not filtered.

Notes and Constraints

  • This feature is available for dual-stream joins only.
  • It is not recommended to add other operators after the join operation. After the stream join, data is directly output to the sink.
  • This feature supports only inner, left, and right joins. It is not supported for operations involving the MultiJoin operator.

How to Use

Add the hint parameter /*+ OPTIONS('allows.generated-retracts'='false') */ for a join.

The following is an example SQL statement:

CREATE TABLE user_info (`user_id` VARCHAR, `user_name` VARCHAR) WITH (
  'connector' = 'kafka',
  'topic' = 'user_info_001',
  'properties.bootstrap.servers' = 'Service IP address of the Kafka broker instance:Kafka port',
  'properties.group.id' = 'testGroup',
  'scan.startup.mode' = 'latest-offset',
  'value.format' = 'csv'
);
CREATE table print(
  `user_id` VARCHAR,
  `user_name` VARCHAR,
  `score` INT
) WITH ('connector' = 'print');
CREATE TABLE user_score (user_id VARCHAR, score INT) WITH (
  'connector' = 'kafka',
  'topic' = 'user_score_001',
  'properties.bootstrap.servers' = 'Service IP address of the Kafka broker instance:Kafka port',
  'properties.group.id' = 'testGroup',
  'scan.startup.mode' = 'latest-offset',
  'value.format' = 'csv'
);
INSERT INTO
  print
SELECT
  t.user_id,
  t.user_name,
  d.score
FROM
  user_info as t
  LEFT JOIN 
  /*+ OPTIONS('allows.generated-retracts'='false') */ 
  user_score as d ON t.user_id = d.user_id;

Example:

Enter ["1", "zs"] in the user_info table.

Enter ["1", 25] in the user_score table.

Result for print sink
  • Feature not used:

    +I["1", "zs", null]

    -D["1", "zs", null]

    +I["1", "zs", 25]

  • Feature used:

    +I["1", "zs", null]

    +I["1", "zs", 25]