This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 3a97190661 [fix](Nereids) Compare plan with their output rather than
string in UnrankTest (#17698)
3a97190661 is described below
commit 3a971906615b8dad7a4d2d41bd9841f40b15686c
Author: 谢健 <[email protected]>
AuthorDate: Tue Mar 14 11:10:06 2023 +0800
[fix](Nereids) Compare plan with their output rather than string in
UnrankTest (#17698)
After adding a unique ID, the unRankTest fail because each plan has a
different ID in the string.
To avoid the effect of unique ID, Compare the plan with the output rather
than the string
---
.../test/java/org/apache/doris/nereids/memo/RankTest.java | 2 +-
.../java/org/apache/doris/nereids/util/PlanChecker.java | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/nereids/memo/RankTest.java
b/fe/fe-core/src/test/java/org/apache/doris/nereids/memo/RankTest.java
index f432f4a1cd..70fe91afc9 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/nereids/memo/RankTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/memo/RankTest.java
@@ -61,7 +61,7 @@ public class RankTest extends TPCHTestBase {
.rewrite()
.optimize()
.getBestPlanTree(PhysicalProperties.GATHER);
- Assertions.assertEquals(plan1.treeString(), plan2.treeString());
+ Assertions.assertTrue(PlanChecker.isPlanEqualWithoutID(plan1,
plan2));
}
}
}
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanChecker.java
b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanChecker.java
index ce713c2f4d..1714f5083d 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanChecker.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/PlanChecker.java
@@ -596,4 +596,18 @@ public class PlanChecker {
return this;
}
+ public static boolean isPlanEqualWithoutID(Plan plan1, Plan plan2) {
+ if (plan1.arity() != plan2.arity()
+ || !plan1.getOutput().equals(plan2.getOutput()) ||
plan1.getClass() != plan2.getClass()) {
+ System.out.println(plan1);
+ System.out.println(plan2);
+ return false;
+ }
+ for (int i = 0; i < plan1.arity(); i++) {
+ if (!isPlanEqualWithoutID(plan1.child(i), plan2.child(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]