jackwener commented on code in PR #17691: URL: https://github.com/apache/doris/pull/17691#discussion_r1133181012
########## fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateUnnecessaryProjectTest.java: ########## @@ -55,57 +52,49 @@ protected void runBeforeAll() throws Exception { } @Test - public void testEliminateNonTopUnnecessaryProject() { + void testEliminateNonTopUnnecessaryProject() { LogicalPlan unnecessaryProject = new LogicalPlanBuilder(PlanConstructor.newLogicalOlapScan(0, "t1", 0)) .project(ImmutableList.of(1, 0)) .filter(BooleanLiteral.FALSE) .build(); - CascadesContext cascadesContext = MemoTestUtils.createCascadesContext(unnecessaryProject); - cascadesContext.topDownRewrite(new EliminateUnnecessaryProject()); - - Plan actual = cascadesContext.getMemo().copyOut(); - Assertions.assertTrue(actual.child(0) instanceof LogicalProject); + PlanChecker.from(MemoTestUtils.createConnectContext(), unnecessaryProject) + .applyTopDown(new EliminateUnnecessaryProject()) + .matches(logicalProject()); Review Comment: please use matchesFromRoot in this test class ########## fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanChecker.java: ########## @@ -126,6 +127,12 @@ public PlanChecker applyTopDown(RuleFactory ruleFactory) { return applyTopDown(ruleFactory.buildRules()); } + public PlanChecker applyTopDown(CustomRewriter customRewriter) { Review Comment: 👍 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org