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 """