Jing Zhang created FLINK-14946: ---------------------------------- Summary: Retraction infer would result in bad plan under corner case in blink planner Key: FLINK-14946 URL: https://issues.apache.org/jira/browse/FLINK-14946 Project: Flink Issue Type: Bug Components: Table SQL / Planner Affects Versions: 1.9.1, 1.9.0 Reporter: Jing Zhang Attachments: image-2019-11-26-14-54-34-797.png
Retractions rule would result in bad plan under some case, I simplify the case like the following sql, complete test case could be found in attachments. {code:scala} val join_sql = """ |SELECT | ll.a AS a, | ll.b AS b, | cnt |FROM ( | SELECT a, b, COUNT(c) AS cnt FROM l GROUP BY a, b |) ll |JOIN ( | SELECT a, b FROM r GROUP BY a, b |) rr ON |(ll.a = rr.a AND ll.b = rr.b) """.stripMargin !image-2019-11-26-14-52-52-824.png! val sqlQuery = s""" |SELECT a, b_1, SUM(cnt) AS cnt |FROM ( | SELECT *, b AS b_1 FROM (${join_sql}) | UNION ALL | SELECT *, 'SEA' AS b_1 FROM (${join_sql}) |) AS total_result |GROUP BY a, b_1 """.stripMargin {code} The plan is : !image-2019-11-26-14-54-34-797.png! After retraction infer, we expect two join node in the above plan has `AccRetract` asAccMode. However, AccMode of Join1 is right, accMode of Join2 is unexpected. -- This message was sent by Atlassian Jira (v8.3.4#803005)