Skip to content

Commit 03a63dc

Browse files
committed
update
Signed-off-by: Weizhen Wang <[email protected]>
1 parent b684f00 commit 03a63dc

File tree

1 file changed

+12
-32
lines changed

1 file changed

+12
-32
lines changed

pkg/planner/core/physical_plan_trace_test.go

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -146,45 +146,25 @@ func TestPhysicalOptimizerTrace(t *testing.T) {
146146
otrace := sctx.GetSessionVars().StmtCtx.OptimizeTracer.Physical
147147
require.NotNil(t, otrace)
148148
elements := map[int]string{
149-
25: "TableReader",
150-
17: "HashAgg",
151-
29: "TableReader",
149+
8: "TableReader",
150+
28: "TableReader",
152151
16: "HashJoin",
153-
10: "Sort",
154-
8: "Projection",
155-
23: "TableFullScan",
156-
24: "HashAgg",
157-
27: "TableReader",
158-
26: "TableFullScan",
159-
19: "HashAgg",
160-
28: "TableFullScan",
161-
15: "HashJoin",
162-
14: "HashAgg",
163-
}
164-
final := map[int]struct{}{
165-
23: {},
166-
17: {},
167-
25: {},
168-
24: {},
169-
28: {},
170-
29: {},
171-
16: {},
172-
14: {},
173-
10: {},
174-
8: {},
152+
18: "TableReader",
153+
17: "HashAgg",
154+
11: "HashAgg",
155+
15: "HashAgg",
156+
27: "HashAgg",
157+
29: "HashAgg",
175158
}
159+
final := map[int]struct{}{}
176160
for _, c := range otrace.Candidates {
177161
tp, ok := elements[c.ID]
178-
if !ok || tp != c.TP {
179-
t.FailNow()
180-
}
162+
require.Truef(t, ok, "ID: %d not found in elements", c.ID)
163+
require.Equalf(t, tp, c.TP, "ID: %d, expected TP: %s, got TP: %s", c.ID, tp, c.TP)
181164
}
182165
require.Len(t, otrace.Candidates, len(elements))
183166
for _, p := range otrace.Final {
184-
_, ok := final[p.ID]
185-
if !ok {
186-
t.FailNow()
187-
}
167+
require.Contains(t, final, p.ID, "ID: %d not found in final", p.ID)
188168
}
189169
require.Len(t, otrace.Final, len(final))
190170
}

0 commit comments

Comments
 (0)