[
https://issues.apache.org/jira/browse/FLINK-40902?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated FLINK-40902:
-----------------------------------
Labels: pull-request-available (was: )
> LATERAL SNAPSHOT join wrongly rejected when a local filter targets the join
> key column
> --------------------------------------------------------------------------------------
>
> Key: FLINK-40902
> URL: https://issues.apache.org/jira/browse/FLINK-40902
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Reporter: Fabian Hueske
> Assignee: Fabian Hueske
> Priority: Major
> Labels: pull-request-available
>
> A LATERAL SNAPSHOT join that has a valid equi-join predicate is wrongly
> rejected with
> "LATERAL SNAPSHOT join requires at least one equality predicate."
> whenever the query also has a local filter on the same column that carries the
> equi-join predicate.
> Example (fails):
> SELECT o.order_id, c.city
> FROM orders AS o
> JOIN LATERAL SNAPSHOT(
> input => TABLE customers,
> on_time => DESCRIPTOR(rowtime)
> ) AS c
> ON o.customer_id = c.customer_id
> WHERE o.customer_id = 3200;
> A filter on any other (non-join-key) column, e.g. WHERE o.amount = 42, works
> fine.
> Root cause:
> LogicalJoinToLateralSnapshotJoinRule enforces the equi-key requirement via
> join.analyzeCondition().leftKeys.isEmpty(). When the local filter targets the
> join key, Calcite's constant propagation pushes o.customer_id = 3200 to the
> probe
> side, infers customers.customer_id = 3200 on the build side, and then
> simplifies
> the join condition o.customer_id = c.customer_id to TRUE. analyzeCondition()
> then
> reports no equi-keys and the rule rejects a join that is in fact an
> equi-join. The
> error message is also misleading, since an equality predicate was provided.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)