Skip to content

Commit b851d84

Browse files
committed
fix code style
1 parent 9529c9e commit b851d84

File tree

6 files changed

+33
-38
lines changed

6 files changed

+33
-38
lines changed

fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraphv2/receiver/PlanReceiver.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
import java.util.HashSet;
5252
import java.util.List;
5353
import java.util.Set;
54-
import java.util.stream.Collectors;
5554

5655
/**
5756
* The Receiver is used for cached the plan that has been emitted and build the new plan, it's the dp table in paper
@@ -121,10 +120,7 @@ public EmitState emitCsgCmp(long left, long right, List<Edge> edges) {
121120
}
122121

123122
emitCount += 1;
124-
// if (emitCount > limit || System.currentTimeMillis() - startTime > timeLimit) {
125-
// return EmitState.FAIL;
126-
// }
127-
if (emitCount > limit) {
123+
if (emitCount > limit || System.currentTimeMillis() - startTime > timeLimit) {
128124
return EmitState.FAIL;
129125
}
130126
edges.addAll(missingEdges);

fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Group.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,18 @@ public GroupExpression getBestPlan(PhysicalProperties properties) {
255255
return null;
256256
}
257257

258+
/**
259+
* extract the best physical plan's corresponding logical plan
260+
*/
258261
public Plan getBestLogicalPlan(GroupExpression groupExpression) {
259262
List<Group> childrenGroups = groupExpression.children();
260263
for (GroupExpression logicalExpression : logicalExpressions) {
261264
if (childrenGroups.equals(logicalExpression.children())) {
262265
return logicalExpression.getPlan();
263266
}
264267
}
265-
if (groupExpression.getPlan() instanceof PhysicalDistribute || groupExpression.getPlan() instanceof PhysicalQuickSort || logicalExpressions.isEmpty()) {
268+
if (groupExpression.getPlan() instanceof PhysicalDistribute
269+
|| groupExpression.getPlan() instanceof PhysicalQuickSort || logicalExpressions.isEmpty()) {
266270
return null;
267271
} else {
268272
return getLogicalExpression().getPlan();

fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,27 @@ public Plan copyOut(Group group, boolean includeGroupExpression) {
362362
GroupExpression logicalExpression = group.getFirstLogicalExpression();
363363
return copyOut(logicalExpression, includeGroupExpression);
364364
}
365+
366+
/**
367+
* copyOut the logicalExpression.
368+
* @param logicalExpression the logicalExpression what want to copyOut
369+
* @param includeGroupExpression whether include group expression in the plan
370+
* @return plan
371+
*/
372+
public Plan copyOut(GroupExpression logicalExpression, boolean includeGroupExpression) {
373+
List<Plan> children = Lists.newArrayList();
374+
for (Group child : logicalExpression.children()) {
375+
children.add(copyOut(child, includeGroupExpression));
376+
}
377+
Plan planWithChildren = logicalExpression.getPlan().withChildren(children);
378+
379+
Optional<GroupExpression> groupExpression = includeGroupExpression
380+
? Optional.of(logicalExpression)
381+
: Optional.empty();
382+
383+
return planWithChildren.withGroupExpression(groupExpression);
384+
}
385+
365386
public Plan copyOutBestLogicalPlan() {
366387
return copyOutBestLogicalPlan(root, PhysicalProperties.ANY);
367388
}
@@ -380,7 +401,8 @@ private Plan copyOutBestLogicalPlan(Group rootGroup, PhysicalProperties physical
380401
rootGroup.setChosenProperties(physicalProperties);
381402
rootGroup.setChosenGroupExpressionId(groupExpression.getId().asInt());
382403
}
383-
List<PhysicalProperties> inputPropertiesList = groupExpression.getInputPropertiesList(physicalProperties);
404+
List<PhysicalProperties> inputPropertiesList =
405+
groupExpression.getInputPropertiesList(physicalProperties);
384406
List<Plan> planChildren = Lists.newArrayList();
385407
for (int i = 0; i < groupExpression.arity(); i++) {
386408
planChildren.add(copyOutBestLogicalPlan(groupExpression.child(i), inputPropertiesList.get(i)));
@@ -421,26 +443,6 @@ private Plan copyOutBestLogicalPlan(Group rootGroup, PhysicalProperties physical
421443
}
422444
}
423445

424-
/**
425-
* copyOut the logicalExpression.
426-
* @param logicalExpression the logicalExpression what want to copyOut
427-
* @param includeGroupExpression whether include group expression in the plan
428-
* @return plan
429-
*/
430-
public Plan copyOut(GroupExpression logicalExpression, boolean includeGroupExpression) {
431-
List<Plan> children = Lists.newArrayList();
432-
for (Group child : logicalExpression.children()) {
433-
children.add(copyOut(child, includeGroupExpression));
434-
}
435-
Plan planWithChildren = logicalExpression.getPlan().withChildren(children);
436-
437-
Optional<GroupExpression> groupExpression = includeGroupExpression
438-
? Optional.of(logicalExpression)
439-
: Optional.empty();
440-
441-
return planWithChildren.withGroupExpression(groupExpression);
442-
}
443-
444446
/**
445447
* init memo by a first plan.
446448
* @param plan first plan

fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ColumnPruning.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ public Plan visitLogicalRepeat(LogicalRepeat<? extends Plan> repeat, PruneContex
275275
}
276276

277277
@Override
278-
public Plan visitLogicalCTEAnchor(LogicalCTEAnchor<? extends Plan, ? extends Plan> cteAnchor, PruneContext context) {
278+
public Plan visitLogicalCTEAnchor(LogicalCTEAnchor<? extends Plan, ? extends Plan> cteAnchor,
279+
PruneContext context) {
279280
return skipPruneThisAndFirstLevelChildren(cteAnchor);
280281
}
281282

fe/fe-core/src/test/java/org/apache/doris/nereids/jobs/joinorder/hypergraphv2/GraphSimplifierConsistencyTest.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class GraphSimplifierConsistencyTest extends TPCHTestBase {
4141

4242
@Test
4343
public void test() {
44-
for (int t = 3; t < 30; t++) {
44+
for (int t = 3; t < 20; t++) {
4545
for (int e = t - 1; e <= (t * (t - 1)) / 2; e++) {
4646
randomTest(t, e);
4747
}
@@ -70,14 +70,10 @@ private void randomTest(int tableNum, int edgeNum) {
7070
Set<List<String>> res2 = hyperGraphBuilder.evaluate(optimizedPlan);
7171

7272
if (!res1.equals(res2)) {
73-
res1 = hyperGraphBuilder.evaluate(plan);
74-
res2 = hyperGraphBuilder.evaluate(optimizedPlan);
7573
System.out.println("==== ORIGINAL PLAN ====");
7674
System.out.println(originalPlanStr);
7775
System.out.println("==== OPTIMIZED PLAN ====");
7876
System.out.println(optimizedPlan.treeString());
79-
cascadesContext = MemoTestUtils.createCascadesContext(connectContext, plan);
80-
PlanChecker.from(cascadesContext).dpHypOptimize().getBestPlanTree();
8177
System.out.println("==== EXPECTED RESULTS ====");
8278
System.out.println(res1);
8379
System.out.println("==== ACTUAL RESULTS ====");

fe/fe-core/src/test/java/org/apache/doris/nereids/jobs/joinorder/hypergraphv2/OtherJoinTest.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
public class OtherJoinTest extends TPCHTestBase {
3636
@Test
3737
public void test() {
38-
for (int t = 3; t < 50; t++) {
38+
for (int t = 3; t < 25; t++) {
3939
for (int e = t - 1; e <= (t * (t - 1)) / 2; e++) {
4040
randomTest(t, e);
4141
}
@@ -61,14 +61,10 @@ private void randomTest(int tableNum, int edgeNum) {
6161
Set<List<String>> res2 = hyperGraphBuilder.evaluate(optimizedPlan);
6262

6363
if (!res1.equals(res2)) {
64-
res1 = hyperGraphBuilder.evaluate(plan);
65-
res2 = hyperGraphBuilder.evaluate(optimizedPlan);
6664
System.out.println("==== ORIGINAL PLAN ====");
6765
System.out.println(originalPlanStr);
6866
System.out.println("==== OPTIMIZED PLAN ====");
6967
System.out.println(optimizedPlan.treeString());
70-
cascadesContext = MemoTestUtils.createCascadesContext(connectContext, plan);
71-
PlanChecker.from(cascadesContext).dpHypOptimize().getBestPlanTree();
7268
System.out.println("==== EXPECTED RESULTS ====");
7369
System.out.println(res1);
7470
System.out.println("==== ACTUAL RESULTS ====");

0 commit comments

Comments
 (0)