hanyuzheng7 commented on code in PR #29723:
URL: https://github.com/apache/flink/pull/29723#discussion_r4446611542
##########
flink-table/flink-table-planner/src/test/resources/org/apache/flink/table/planner/plan/stream/sql/join/JoinReorderTest.xml:
##########
@@ -728,6 +728,76 @@ Calc(select=[a6, b6, a7, b7, a8, b8])
: +- LegacyTableSourceScan(table=[[default_catalog,
default_database, T8, source: [TestTableSource(a8, b8)]]], fields=[a8, b8])
+- Exchange(distribution=[hash[b7]])
+- LegacyTableSourceScan(table=[[default_catalog, default_database, T7,
source: [TestTableSource(a7, b7)]]], fields=[a7, b7])
+]]>
+ </Resource>
+ </TestCase>
+ <TestCase
name="testFilterOnNullGeneratingSideOfLeftOuterJoin[isBushyJoinReorder=false]">
+ <Resource name="sql">
+ <![CDATA[
+SELECT * FROM T1 LEFT JOIN
+ (SELECT * FROM T2 LEFT JOIN T3 ON a2 = a3 WHERE COALESCE(b3, b2) > 3) tab1
+ ON a1 = a2
+ ]]>
+ </Resource>
+ <Resource name="ast">
+ <![CDATA[
+LogicalProject(a1=[$0], b1=[$1], c1=[$2], a2=[$3], b2=[$4], c2=[$5], a3=[$6],
b3=[$7], c3=[$8])
++- LogicalJoin(condition=[=($0, $3)], joinType=[left])
+ :- LogicalTableScan(table=[[default_catalog, default_database, T1, source:
[TestTableSource(a1, b1, c1)]]])
+ +- LogicalProject(a2=[$0], b2=[$1], c2=[$2], a3=[$3], b3=[$4], c3=[$5])
+ +- LogicalFilter(condition=[>(COALESCE($4, $1), 3)])
+ +- LogicalJoin(condition=[=($0, $3)], joinType=[left])
+ :- LogicalTableScan(table=[[default_catalog, default_database, T2,
source: [TestTableSource(a2, b2, c2)]]])
+ +- LogicalTableScan(table=[[default_catalog, default_database, T3,
source: [TestTableSource(a3, b3, c3)]]])
+]]>
+ </Resource>
+ <Resource name="optimized rel plan">
+ <![CDATA[
+Join(joinType=[LeftOuterJoin], where=[=(a1, a2)], select=[a1, b1, c1, a2, b2,
c2, a3, b3, c3], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
+:- Exchange(distribution=[hash[a1]])
+: +- LegacyTableSourceScan(table=[[default_catalog, default_database, T1,
source: [TestTableSource(a1, b1, c1)]]], fields=[a1, b1, c1])
++- Exchange(distribution=[hash[a2]])
+ +- Calc(select=[a2, b2, c2, a3, b3, c3], where=[>(COALESCE(b3, b2), 3)])
+ +- Join(joinType=[LeftOuterJoin], where=[=(a2, a3)], select=[a2, b2, c2,
a3, b3, c3], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
+ :- Exchange(distribution=[hash[a2]])
+ : +- LegacyTableSourceScan(table=[[default_catalog,
default_database, T2, source: [TestTableSource(a2, b2, c2)]]], fields=[a2, b2,
c2])
+ +- Exchange(distribution=[hash[a3]])
+ +- LegacyTableSourceScan(table=[[default_catalog,
default_database, T3, source: [TestTableSource(a3, b3, c3)]]], fields=[a3, b3,
c3])
+]]>
+ </Resource>
+ </TestCase>
+ <TestCase
name="testFilterOnNullGeneratingSideOfLeftOuterJoin[isBushyJoinReorder=true]">
Review Comment:
`JoinReorderTestBase` runs every case with both values of
`isBushyJoinReorder`. With `false`, it sets the bushy threshold to 3, so the
two inputs of the outer join were reordered by `FlinkBushyJoinReorderRule` in
both runs. I joined T4 and T5 as well: with four inputs, the run with `false`
uses `LoptOptimizeJoinRule`, and the plans differ. Without the fix, both rules
apply the filter above the outer join.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]