Skip to content

Commit

Permalink
[FLINK-31362][table] plans
Browse files Browse the repository at this point in the history
  • Loading branch information
snuyanzin committed Aug 22, 2024
1 parent 8a706db commit 61e50f1
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -683,4 +683,23 @@ HashJoin(joinType=[LeftOuterJoin], where=[(k = k0)], select=[k, v, k0, v0], isBr
]]>
</Resource>
</TestCase>
<TestCase name="testRightOuterJoinOnFalse">
<Resource name="sql">
<![CDATA[SELECT * FROM MyTable2 RIGHT OUTER JOIN MyTable1 ON false]]>
</Resource>
<Resource name="ast">
<![CDATA[
LogicalProject(d=[$0], e=[$1], f=[$2], g=[$3], h=[$4], a=[$5], b=[$6], c=[$7])
+- LogicalJoin(condition=[false], joinType=[right])
:- LogicalTableScan(table=[[default_catalog, default_database, MyTable2, source: [TestTableSource(d, e, f, g, h)]]])
+- LogicalTableScan(table=[[default_catalog, default_database, MyTable1, source: [TestTableSource(a, b, c)]]])
]]>
</Resource>
<Resource name="optimized exec plan">
<![CDATA[
Calc(select=[null:INTEGER AS d, null:BIGINT AS e, null:INTEGER AS f, null:VARCHAR(2147483647) AS g, null:BIGINT AS h, a, b, c])
+- LegacyTableSourceScan(table=[[default_catalog, default_database, MyTable1, source: [TestTableSource(a, b, c)]]], fields=[a, b, c])
]]>
</Resource>
</TestCase>
</Root>
Original file line number Diff line number Diff line change
Expand Up @@ -917,9 +917,7 @@ LogicalProject(d=[$0], e=[$1], f=[$2], g=[$3], h=[$4], a=[$5], b=[$6], c=[$7])
</Resource>
<Resource name="optimized exec plan">
<![CDATA[
NestedLoopJoin(joinType=[RightOuterJoin], where=[true], select=[d, e, f, g, h, a, b, c], build=[left])
:- Exchange(distribution=[broadcast])
: +- Values(tuples=[[]], values=[d, e, f, g, h])
Calc(select=[null:INTEGER AS d, null:BIGINT AS e, null:INTEGER AS f, null:VARCHAR(2147483647) AS g, null:BIGINT AS h, a, b, c])
+- LegacyTableSourceScan(table=[[default_catalog, default_database, MyTable1, source: [TestTableSource(a, b, c)]]], fields=[a, b, c])
]]>
</Resource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -795,4 +795,23 @@ HashJoin(joinType=[LeftOuterJoin], where=[(k = k0)], select=[k, v, k0, v0], buil
]]>
</Resource>
</TestCase>
<TestCase name="testRightOuterJoinOnFalse">
<Resource name="sql">
<![CDATA[SELECT * FROM MyTable2 RIGHT OUTER JOIN MyTable1 ON false]]>
</Resource>
<Resource name="ast">
<![CDATA[
LogicalProject(d=[$0], e=[$1], f=[$2], g=[$3], h=[$4], a=[$5], b=[$6], c=[$7])
+- LogicalJoin(condition=[false], joinType=[right])
:- LogicalTableScan(table=[[default_catalog, default_database, MyTable2, source: [TestTableSource(d, e, f, g, h)]]])
+- LogicalTableScan(table=[[default_catalog, default_database, MyTable1, source: [TestTableSource(a, b, c)]]])
]]>
</Resource>
<Resource name="optimized exec plan">
<![CDATA[
Calc(select=[null:INTEGER AS d, null:BIGINT AS e, null:INTEGER AS f, null:VARCHAR(2147483647) AS g, null:BIGINT AS h, a, b, c])
+- LegacyTableSourceScan(table=[[default_catalog, default_database, MyTable1, source: [TestTableSource(a, b, c)]]], fields=[a, b, c])
]]>
</Resource>
</TestCase>
</Root>
Original file line number Diff line number Diff line change
Expand Up @@ -795,4 +795,23 @@ SortMergeJoin(joinType=[LeftOuterJoin], where=[(k = k0)], select=[k, v, k0, v0])
]]>
</Resource>
</TestCase>
<TestCase name="testRightOuterJoinOnFalse">
<Resource name="sql">
<![CDATA[SELECT * FROM MyTable2 RIGHT OUTER JOIN MyTable1 ON false]]>
</Resource>
<Resource name="ast">
<![CDATA[
LogicalProject(d=[$0], e=[$1], f=[$2], g=[$3], h=[$4], a=[$5], b=[$6], c=[$7])
+- LogicalJoin(condition=[false], joinType=[right])
:- LogicalTableScan(table=[[default_catalog, default_database, MyTable2, source: [TestTableSource(d, e, f, g, h)]]])
+- LogicalTableScan(table=[[default_catalog, default_database, MyTable1, source: [TestTableSource(a, b, c)]]])
]]>
</Resource>
<Resource name="optimized exec plan">
<![CDATA[
Calc(select=[null:INTEGER AS d, null:BIGINT AS e, null:INTEGER AS f, null:VARCHAR(2147483647) AS g, null:BIGINT AS h, a, b, c])
+- LegacyTableSourceScan(table=[[default_catalog, default_database, MyTable1, source: [TestTableSource(a, b, c)]]], fields=[a, b, c])
]]>
</Resource>
</TestCase>
</Root>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ LogicalProject(a=[$0], d=[$3])
<Resource name="optimized rel plan">
<![CDATA[
LogicalProject(a=[$0], d=[$3])
+- LogicalJoin(condition=[AND(OR(AND(=($0, 1), =($3, 2)), AND(=($0, 2), =($3, 1))), OR(AND(=($0, 3), =($3, 4)), AND(=($0, 4), =($3, 3))), SEARCH($0, Sarg[1, 2]), SEARCH($3, Sarg[1, 2]), SEARCH($0, Sarg[3, 4]), SEARCH($3, Sarg[3, 4]))], joinType=[inner])
+- LogicalJoin(condition=[false], joinType=[inner])
:- LogicalTableScan(table=[[default_catalog, default_database, MyTable1, source: [TestTableSource(a, b, c)]]])
+- LogicalTableScan(table=[[default_catalog, default_database, MyTable2, source: [TestTableSource(d, e, f, g, h)]]])
]]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ limitations under the License.
</Resource>
<Resource name="ast">
<![CDATA[
LogicalProject(EXPR$0=[$SCALAR_QUERY({
LogicalProject(variablesSet=[[$cor0]], EXPR$0=[$SCALAR_QUERY({
LogicalProject(EXPR$0=[-($0, 1)])
LogicalAggregate(group=[{}], agg#0=[COUNT($0)])
LogicalProject(x=[$0])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ WHERE t1a = 'test'
</Resource>
<Resource name="ast">
<![CDATA[
LogicalProject(min_t1d=[$SCALAR_QUERY({
LogicalProject(variablesSet=[[$cor0]], min_t1d=[$SCALAR_QUERY({
LogicalAggregate(group=[{}], EXPR$0=[MIN($0)])
LogicalProject($f0=[$cor0.t1d])
LogicalFilter(condition=[=($0, _UTF-16LE'test')])
Expand Down Expand Up @@ -65,7 +65,7 @@ FROM t1
</Resource>
<Resource name="ast">
<![CDATA[
LogicalProject(min_t3d=[$SCALAR_QUERY({
LogicalProject(variablesSet=[[$cor0]], min_t3d=[$SCALAR_QUERY({
LogicalAggregate(group=[{}], EXPR$0=[MIN($0)])
LogicalProject(t3d=[$3])
LogicalFilter(condition=[=($0, $cor0.t1a)])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,6 @@ class BroadcastHashJoinTest extends JoinTestBase {
.isInstanceOf[TableException]
}

@Test
override def testRightOuterJoinOnFalse(): Unit = {
assertThatThrownBy(() => super.testRightOuterJoinOnFalse())
.hasMessageContaining("Cannot generate a valid execution plan for the given query")
.isInstanceOf[TableException]
}

@Test
override def testRightOuterJoinWithNonEquiPred(): Unit = {
assertThatThrownBy(() => super.testRightOuterJoinWithNonEquiPred())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,6 @@ class ShuffledHashJoinTest extends JoinTestBase {
.isInstanceOf[TableException]
}

@Test
override def testRightOuterJoinOnFalse(): Unit = {
assertThatThrownBy(() => super.testRightOuterJoinOnFalse())
.hasMessageContaining("Cannot generate a valid execution plan for the given query")
.isInstanceOf[TableException]
}

@Test
override def testRightOuterJoinWithNonEquiPred(): Unit = {
assertThatThrownBy(() => super.testRightOuterJoinWithNonEquiPred())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ class SortMergeJoinTest extends JoinTestBase {
.isInstanceOf[TableException]
}

@Test
override def testRightOuterJoinOnFalse(): Unit = {
assertThatThrownBy(() => super.testRightOuterJoinOnFalse())
.hasMessageContaining("Cannot generate a valid execution plan for the given query")
.isInstanceOf[TableException]
}

@Test
override def testRightOuterJoinWithNonEquiPred(): Unit = {
assertThatThrownBy(() => super.testRightOuterJoinWithNonEquiPred())
Expand Down

0 comments on commit 61e50f1

Please sign in to comment.