From f87865fbe2bd74579dd3a68f5ca6a301a78268a1 Mon Sep 17 00:00:00 2001 From: Zou Xinyi Date: Mon, 18 Nov 2024 21:07:36 +0800 Subject: [PATCH] 2 --- .../org/apache/doris/utframe/AnotherDemoTest.java | 15 ++++++++++++++- .../java/org/apache/doris/utframe/DemoTest.java | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/test/java/org/apache/doris/utframe/AnotherDemoTest.java b/fe/fe-core/src/test/java/org/apache/doris/utframe/AnotherDemoTest.java index 2da5a3cabd871e..530fd15a9b6f37 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/utframe/AnotherDemoTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/utframe/AnotherDemoTest.java @@ -25,6 +25,7 @@ import org.apache.doris.catalog.Table; import org.apache.doris.common.DdlException; import org.apache.doris.common.FeConstants; +import org.apache.doris.planner.ExchangeNode; import org.apache.doris.planner.OlapScanNode; import org.apache.doris.planner.PlanFragment; import org.apache.doris.planner.Planner; @@ -120,7 +121,8 @@ public void testCreateDbAndTable() throws Exception { } // 5. query // TODO: we can not process real query for now. So it has to be a explain query - String queryStr = "explain select /*+ SET_VAR(disable_nereids_rules=PRUNE_EMPTY_PARTITION) */ * from db1.tbl1"; + String queryStr = "explain select /*+ SET_VAR(disable_nereids_rules=PRUNE_EMPTY_PARTITION, " + + "enable_parallel_result_sink=true) */ * from db1.tbl1"; StmtExecutor stmtExecutor = new StmtExecutor(ctx, queryStr); stmtExecutor.execute(); Planner planner = stmtExecutor.planner(); @@ -129,5 +131,16 @@ public void testCreateDbAndTable() throws Exception { PlanFragment fragment = fragments.get(0); Assert.assertTrue(fragment.getPlanRoot() instanceof OlapScanNode); Assert.assertEquals(0, fragment.getChildren().size()); + + queryStr = "explain select /*+ SET_VAR(disable_nereids_rules=PRUNE_EMPTY_PARTITION, " + + "enable_parallel_result_sink=false) */ * from db1.tbl1"; + stmtExecutor = new StmtExecutor(ctx, queryStr); + stmtExecutor.execute(); + planner = stmtExecutor.planner(); + fragments = planner.getFragments(); + Assert.assertEquals(2, fragments.size()); + fragment = fragments.get(0); + Assert.assertTrue(fragment.getPlanRoot() instanceof ExchangeNode); + Assert.assertEquals(1, fragment.getChildren().size()); } } diff --git a/fe/fe-core/src/test/java/org/apache/doris/utframe/DemoTest.java b/fe/fe-core/src/test/java/org/apache/doris/utframe/DemoTest.java index 289f6c9902d8f8..f1f9fd7ef23d5c 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/utframe/DemoTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/utframe/DemoTest.java @@ -26,6 +26,7 @@ import org.apache.doris.catalog.OlapTable; import org.apache.doris.catalog.Table; import org.apache.doris.common.FeConstants; +import org.apache.doris.planner.ExchangeNode; import org.apache.doris.planner.OlapScanNode; import org.apache.doris.planner.PlanFragment; import org.apache.doris.planner.Planner; @@ -108,7 +109,8 @@ public void testCreateDbAndTable() throws Exception { // 7. query // TODO: we can not process real query for now. So it has to be a explain query - String queryStr = "explain select /*+ SET_VAR(disable_nereids_rules=PRUNE_EMPTY_PARTITION) */ * from db1.tbl1"; + String queryStr = "explain select /*+ SET_VAR(disable_nereids_rules=PRUNE_EMPTY_PARTITION, " + + "enable_parallel_result_sink=true) */ * from db1.tbl1"; StmtExecutor stmtExecutor = new StmtExecutor(connectContext, queryStr); stmtExecutor.execute(); Planner planner = stmtExecutor.planner(); @@ -117,5 +119,16 @@ public void testCreateDbAndTable() throws Exception { PlanFragment fragment = fragments.get(0); Assertions.assertTrue(fragment.getPlanRoot() instanceof OlapScanNode); Assertions.assertEquals(0, fragment.getChildren().size()); + + queryStr = "explain select /*+ SET_VAR(disable_nereids_rules=PRUNE_EMPTY_PARTITION, " + + "enable_parallel_result_sink=false) */ * from db1.tbl1"; + stmtExecutor = new StmtExecutor(connectContext, queryStr); + stmtExecutor.execute(); + planner = stmtExecutor.planner(); + fragments = planner.getFragments(); + Assertions.assertEquals(2, fragments.size()); + fragment = fragments.get(0); + Assertions.assertTrue(fragment.getPlanRoot() instanceof ExchangeNode); + Assertions.assertEquals(1, fragment.getChildren().size()); } }