Martijn Visser created FLINK-40890:
--------------------------------------

             Summary: LATERAL SNAPSHOT build side passes TRY_RESOLVE with 
non-deterministic columns
                 Key: FLINK-40890
                 URL: https://issues.apache.org/jira/browse/FLINK-40890
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
    Affects Versions: 2.4.0
            Reporter: Martijn Visser


In StreamNonDeterministicUpdatePlanVisitor the generic join rule also covers 
StreamPhysicalLateralSnapshotJoin, so the build side only has to be 
deterministic when it has no unique key. LateralSnapshotJoinOperator keys its 
MapState by the full build row and looks retractions up the same way, so the 
unique key does not help there. A build view like
{code:sql}
SELECT bk, bv, CAST(NOW() AS STRING) AS n FROM b_pk
{code}
passes {{TRY_RESOLVE}} and gets no advice from EXPLAIN PLAN_ADVICE when b_pk 
has a primary key, and is rejected when it has none. At runtime the retraction 
misses ({{numUnmatchedBuildRetractions}}) and the old build row stays in the 
snapshot.

The visitor should require all build-side columns to be deterministic whenever 
the build input has updates.



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

Reply via email to