[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
This commit is contained in:
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user