Martijn Visser created FLINK-41763:
--------------------------------------

             Summary: KeyedLookupJoinWrapper emits another key's lookup row in 
deletes on the heap state backend
                 Key: FLINK-41763
                 URL: https://issues.apache.org/jira/browse/FLINK-41763
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Runtime
            Reporter: Martijn Visser


When a lookup join with TRY_RESOLVE runs on a CDC source and the lookup side 
has a projecting calc, KeyedLookupJoinWrapper keeps the collected lookup rows 
in keyed state by reference. The collected row is the calc's reused output 
GenericRowData, so on the hashmap state backend every key ends up pointing at 
the same object, and a -D carries the dimension row last fetched for a 
different key. With RocksDB the result is correct because the state is 
serialized. It happens with pipeline.object-reuse on and off. The wrapper 
should copy the collected rows before it stores them.

{code:sql}
SET 'table.optimizer.non-deterministic-update.strategy' = 'TRY_RESOLVE';
CREATE TABLE src (id INT, k STRING, pt AS PROCTIME(), PRIMARY KEY (id) NOT 
ENFORCED) WITH (...); -- +I(1,A), +I(2,B), -D(1,A)
CREATE TABLE dim (k STRING, v STRING, extra INT) WITH (...); -- (A,a,1), (B,b,2)
CREATE VIEW dimv AS SELECT k, UPPER(v) AS v FROM dim;
INSERT INTO sink SELECT s.id, s.k, d.k, d.v FROM src AS s
  JOIN dimv FOR SYSTEM_TIME AS OF s.pt AS d ON s.k = d.k AND UPPER(d.v) <> 
'ZZZ';
{code}




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to