pingcap / pingcap/tidb

planner: better move explain-assertion-related test cases to explain test pkg

Open
#36,497 0 comments 0 reactions 1 assignee Claimed by @AilinKid View on GitHub
severity/minor sig/planner type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

TiDB has many test unit test cases that directly assert the expected result for explaining statements.
Which is not agile and convenient for altering when later some modification covering stats/planbuilding/plan-opt comes out.

For example:
```
func TestIndexNestedLoopHashJoin(t *testing.T) {
...
tk.MustQuery("desc format = 'brief' select * from t l1 where exists ( select * from t l2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey ) order by `l_orderkey`,`l_linenumber`;").Check(testkit.Rows(
"Sort 7.20 root test.t.l_orderkey, test.t.l_linenumber",
"└─IndexHashJoin 7.20 root semi join, inner:IndexLookUp, outer key:test.t.l_orderkey, inner key:test.t.l_orderkey, equal cond:eq(test.t.l_orderkey, test.t.l_orderkey), other cond:ne(test.t.l_suppkey, test.t.l_suppkey)",
" ├─TableReader(Build) 9.00 root data:Selection",
" │ └─Selection 9.00 cop[tikv] not(isnull(test.t.l_suppkey))",
" │ └─TableFullScan 9.00 cop[tikv] table:l1 keep order:false",
" └─IndexLookUp(Probe) 3.00 root ",
" ├─IndexRangeScan(Build) 3.00 cop[tikv] table:l2, index:PRIMARY(l_orderkey, l_linenumber) range: decided by [eq(test.t.l_orderkey, test.t.l_orderkey)], keep order:false",
" └─Selection(Probe) 3.00 cop[tikv] not(isnull(test.t.l_suppkey))",
" └─TableRowIDScan 3.00 cop[tikv] table:l2 keep order:false"))
...
```

### 2. What did you expect to see? (Required)
explain-assertion-related test cases should be in explain test pkg

### 3. What did you see instead (Required)
as you see

### 4. What is your TiDB version? (Required)

master

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.