From 77ff75b954c82a3da71887732a3b92cf83c238d7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 25 Jul 2025 14:02:06 +0800 Subject: [PATCH] branch-2.1: [opt](nereids) use one fragment to execute point query #53541 (#53574) Cherry-picked from #53541 Co-authored-by: 924060929 --- .../nereids/properties/ChildOutputPropertyDeriver.java | 4 ++++ .../org/apache/doris/qe/ShortCircuitQueryContext.java | 6 ++++-- .../suites/point_query_p0/test_point_query.groovy | 10 ++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java index 270712496e..94a362ea71 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java @@ -166,6 +166,10 @@ public class ChildOutputPropertyDeriver extends PlanVisitor exprs = new ArrayList<>(); - OlapScanNode olapScanNode = (OlapScanNode) planner.getFragments().get(1).getPlanRoot(); + OlapScanNode olapScanNode = (OlapScanNode) planner.getScanNodes().get(0); if (olapScanNode.getProjectList() != null) { // project on scan node exprs.addAll(olapScanNode.getProjectList().stream() @@ -81,7 +83,7 @@ public class ShortCircuitQueryContext { serializedOutputExpr = ByteString.copyFrom( new TSerializer().serialize(exprList)); this.cacheID = UUID.randomUUID(); - this.scanNode = ((OlapScanNode) planner.getScanNodes().get(0)); + this.scanNode = olapScanNode; this.tbl = this.scanNode.getOlapTable(); this.schemaVersion = this.tbl.getBaseSchemaVersion(); this.analzyedQuery = analzyedQuery; diff --git a/regression-test/suites/point_query_p0/test_point_query.groovy b/regression-test/suites/point_query_p0/test_point_query.groovy index 3962d76c51..037d9a2907 100644 --- a/regression-test/suites/point_query_p0/test_point_query.groovy +++ b/regression-test/suites/point_query_p0/test_point_query.groovy @@ -420,6 +420,16 @@ suite("test_point_query", "nonConcurrent") { } } + def ensure_one_fragment = { + sql "set enable_nereids_planner=true" + explain { + sql "select * from table_with_chars where col1 = 10" + check { explainStr -> + assertEquals(1, explainStr.count("PLAN FRAGMENT")) + } + } + }() + // test variant type sql "DROP TABLE IF EXISTS test_with_variant" sql """