You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2024/06/19 06:09:19 UTC
(doris) branch master updated: [fix](topn-filter) throw out of bound exception when union has no child (#36469)
This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new db8344e1685 [fix](topn-filter) throw out of bound exception when union has no child (#36469)
db8344e1685 is described below
commit db8344e168509c76762ad6388f1b3bb080babc33
Author: morrySnow <10...@users.noreply.github.com>
AuthorDate: Wed Jun 19 14:09:13 2024 +0800
[fix](topn-filter) throw out of bound exception when union has no child (#36469)
introduced by #35405
---
.../nereids/processor/post/TopnFilterPushDownVisitor.java | 10 +++++++---
regression-test/suites/nereids_tpch_p0/tpch/topn-filter.groovy | 2 ++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/TopnFilterPushDownVisitor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/TopnFilterPushDownVisitor.java
index 8c9792b6751..5691c701bf1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/TopnFilterPushDownVisitor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/TopnFilterPushDownVisitor.java
@@ -52,7 +52,8 @@ import java.util.Map;
* push down topn filter
*/
public class TopnFilterPushDownVisitor extends PlanVisitor<Boolean, PushDownContext> {
- private TopnFilterContext topnFilterContext;
+
+ private final TopnFilterContext topnFilterContext;
public TopnFilterPushDownVisitor(TopnFilterContext topnFilterContext) {
this.topnFilterContext = topnFilterContext;
@@ -109,10 +110,13 @@ public class TopnFilterPushDownVisitor extends PlanVisitor<Boolean, PushDownCont
@Override
public Boolean visitPhysicalSetOperation(
PhysicalSetOperation setOperation, PushDownContext ctx) {
- boolean pushedDown = pushDownFilterToSetOperatorChild(setOperation, ctx, 0);
+ boolean pushedDown = false;
+ if (setOperation.arity() > 0) {
+ pushedDown = pushDownFilterToSetOperatorChild(setOperation, ctx, 0);
+ }
if (setOperation instanceof Union) {
- for (int i = 1; i < setOperation.children().size(); i++) {
+ for (int i = 1; i < setOperation.arity(); i++) {
// push down to the other children
pushedDown |= pushDownFilterToSetOperatorChild(setOperation, ctx, i);
}
diff --git a/regression-test/suites/nereids_tpch_p0/tpch/topn-filter.groovy b/regression-test/suites/nereids_tpch_p0/tpch/topn-filter.groovy
index 617794e1988..9bee2140098 100644
--- a/regression-test/suites/nereids_tpch_p0/tpch/topn-filter.groovy
+++ b/regression-test/suites/nereids_tpch_p0/tpch/topn-filter.groovy
@@ -156,4 +156,6 @@ suite("topn-filter") {
}
qt_groupingsets2 "select n_regionkey, sum(n_nationkey) from nation group by grouping sets((n_regionkey)) order by n_regionkey limit 2;"
+
+ sql """select * from (select 1 as id union all select 2 as id) tmp order by id limit 100"""
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org