Mihai Budiu created CALCITE-7874:
------------------------------------
Summary: RelDecorrelator drops the MATCH_CONDITION of an ASOF JOIN
Key: CALCITE-7874
URL: https://issues.apache.org/jira/browse/CALCITE-7874
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.42.0
Reporter: Mihai Budiu
Assignee: Mihai Budiu
Fix For: 1.43.0
This query fails:
{code:sql}
SELECT *
FROM (VALUES (NULL, 0), (1, NULL), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (2,
3), (3, 4)) AS t1(k, t)
ASOF JOIN (VALUES (1, NULL), (1, 2), (1, 3), (2, 10), (2, 0)) AS t2(k, t)
MATCH_CONDITION t2.t < t1.t
ON t1.k = t2.k
WHERE EXISTS (SELECT 1 FROM (VALUES 1) AS t3(k) WHERE t3.k = t1.k);
{code}
{noformat}
Caused by: java.lang.RuntimeException: Error while applying rule
JoinPushExpressionsRule,
args
[rel#89:LogicalJoin.NONE.[](left=RelSubset#87,right=RelSubset#88,condition==($0,
$2),joinType=asof)]
Caused by: java.lang.ClassCastException: class
org.apache.calcite.rel.logical.LogicalJoin
cannot be cast to class org.apache.calcite.rel.logical.LogicalAsofJoin
at
org.apache.calcite.plan.RelOptUtil.pushDownJoinConditions(RelOptUtil.java:4000)
at
org.apache.calcite.rel.rules.JoinPushExpressionsRule.onMatch(JoinPushExpressionsRule.java:72)
{noformat}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)