Fabian Hueske created FLINK-40915:
-------------------------------------

             Summary: Relax non-deterministic join-condition check for LATERAL 
SNAPSHOT join
                 Key: FLINK-40915
                 URL: https://issues.apache.org/jira/browse/FLINK-40915
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / Planner
            Reporter: Fabian Hueske


In `StreamNonDeterministicUpdatePlanVisitor.visitJoin`, the generic join 
handling rejects a non-deterministic join condition whenever the join output 
may carry updates (build side updates) or for LEFT joins. The LATERAL SNAPSHOT 
join (LSJ) currently goes through this generic check, but it is stricter than 
necessary for LSJ: the LSJ output is append-only, and the join condition is 
evaluated only once per probe row at join time. It is never re-evaluated when 
build rows are retracted (build retractions match the operator's internal 
whole-row-keyed multiset by row equality), so a non-deterministic condition 
cannot cause the retraction-matching corruption the check guards against. As a 
result, valid LSJ queries with a non-deterministic join condition (e.g. an 
updating build side, or a LEFT LSJ even with insert-only inputs) are rejected 
unnecessarily under TRY_RESOLVE.

Proposed change:
 * exclude StreamPhysicalLateralSnapshotJoin from the 
non-deterministic-condition check in visitJoin.
 * Add tests covering a non-deterministic join condition with an updating build 
side and a LEFT LSJ variant, and confirm regular-join behavior is unchanged 
(NonDeterministicDagTest).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to