[ 
https://issues.apache.org/jira/browse/FLINK-40915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18123390#comment-18123390
 ] 

Gustavo de Morais commented on FLINK-40915:
-------------------------------------------

One important clarifying note: this is only about the non-equi part of the join 
condition. Non-deterministic expressions used in equality predicates are pushed 
by the planner into a Calc below the join, so at this point in the visitor the 
equi part of {{joinCondition}} only references input columns, and any remaining 
non-deterministic calls are in the non-equi part. The equi-join keys still need 
to be deterministic on the build side, since they're used for partitioning and 
state lookup, but that's already covered by requiring the whole build row to be 
deterministic when the build side is updating

> 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
>            Priority: Major
>
> 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