Skip to content

Commit

Permalink
2
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyiZzz committed Nov 18, 2024
1 parent 838b8c3 commit f87865f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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());
}
}
15 changes: 14 additions & 1 deletion fe/fe-core/src/test/java/org/apache/doris/utframe/DemoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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());
}
}

0 comments on commit f87865f

Please sign in to comment.