diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownLimit.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownLimit.java index 8aaeba36f32742..1cc7173d42ad73 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownLimit.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownLimit.java @@ -138,6 +138,7 @@ private Plan pushLimitThroughJoin(LogicalLimit limit, LogicalJoi join.left(), limit.withChildren(join.right()) ); + case FULL_OUTER_JOIN: case CROSS_JOIN: return join.withChildren( limit.withChildren(join.left()), diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/PushDownLimitTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/PushDownLimitTest.java index 2ca848af3c4034..c9b13982ec2c56 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/PushDownLimitTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/PushDownLimitTest.java @@ -183,6 +183,28 @@ void testPushLimitThroughCrossJoin() { ); } + @Test + void testPushLimitThroughFullOuterJoin() { + test(JoinType.FULL_OUTER_JOIN, true, + logicalLimit( + logicalProject( + logicalJoin( + logicalLimit(logicalOlapScan().when(s -> s.getTable().getName().equals("score"))), + logicalLimit(logicalOlapScan().when(s -> s.getTable().getName().equals("student"))) + ).when(j -> j.getJoinType() == JoinType.FULL_OUTER_JOIN) + ) + ) + ); + test(JoinType.FULL_OUTER_JOIN, false, + logicalLimit( + logicalJoin( + logicalLimit(logicalOlapScan().when(s -> s.getTable().getName().equals("score"))), + logicalLimit(logicalOlapScan().when(s -> s.getTable().getName().equals("student"))) + ).when(j -> j.getJoinType() == JoinType.FULL_OUTER_JOIN) + ) + ); + } + @Test void testPushLimitThroughInnerJoin() { test(JoinType.INNER_JOIN, true,