-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
planner: update some UTs from cost model1 to model2 #38959
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
@@ -461,12 +462,12 @@ func TestPointGetUserVarPlanCache(t *testing.T) { | |||
tk.Session().SetSessionManager(&testkit.MockSessionManager{PS: ps}) | |||
tk.MustQuery(fmt.Sprintf("explain for connection %d", tkProcess.ID)).Check(testkit.Rows( // can use idx_a | |||
`Projection_9 1.00 root test.t1.a, test.t1.b, test.t2.a, test.t2.b`, | |||
`└─IndexJoin_17 1.00 root inner join, inner:TableReader_13, outer key:test.t2.a, inner key:test.t1.a, equal cond:eq(test.t2.a, test.t1.a)`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected, 1) model2 prefers to use Scan instead of Lookup, 2) model2 prefers to use MJ if no much data to process.
@@ -424,7 +424,7 @@ | |||
"Name": "TestEmptyTable", | |||
"Cases": [ | |||
"TableReader(Table(t)->Sel([le(test.t.c1, 50)]))", | |||
"LeftHashJoin{TableReader(Table(t)->Sel([not(isnull(test.t.c1))]))->TableReader(Table(t1)->Sel([not(isnull(test.t1.c1))]))->HashAgg}(test.t.c1,test.t1.c1)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected, pushing the Agg down is safer.
@@ -7,10 +7,9 @@ | |||
"Plan": [ | |||
"HashJoin 2.25 root inner join, equal:[eq(test.t1.a, test.t2.a) eq(test.t1.b, test.t2.b)]", | |||
"├─HashAgg(Build) 1.69 root group by:test.t2.a, test.t2.b, funcs:firstrow(test.t2.a)->test.t2.a, funcs:firstrow(test.t2.b)->test.t2.b", | |||
"│ └─TableReader 1.69 root data:HashAgg", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can ignore this case since it will be solved by #38874.
@@ -3196,47 +3196,44 @@ | |||
{ | |||
"SQL": "explain format = 'brief' select count(*) from fact_t join d1_t on fact_t.d1_k > d1_t.d1_k", | |||
"Plan": [ | |||
"HashAgg 1.00 root funcs:count(Column#12)->Column#11", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected, model2 prefers to use StreamAgg instead of HashAgg if no much data to process.
@@ -7080,10 +7077,11 @@ | |||
" └─TableReader 8000.00 root data:ExchangeSender", | |||
" └─ExchangeSender 8000.00 mpp[tiflash] ExchangeType: PassThrough", | |||
" └─Projection 8000.00 mpp[tiflash] Column#5, test.t.id", | |||
" └─HashAgg 8000.00 mpp[tiflash] group by:test.t.id, test.t.name, funcs:count(1)->Column#5, funcs:firstrow(test.t.id)->test.t.id", | |||
" └─ExchangeReceiver 10000.00 mpp[tiflash] ", | |||
" └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.t.name, collate: utf8mb4_bin], [name: test.t.id, collate: binary]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected, 2PhaseAgg is safer than 1PhaseAgg.
@@ -477,7 +477,7 @@ | |||
}, | |||
{ | |||
"SQL": "select c from t where t.c = 1 and t.d = 1 order by t.a limit 1", | |||
"Best": "IndexReader(Index(t.c_d_e)[[1 1,1 1]])->TopN([test.t.a],0,1)->Projection" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected, pushing it down is safer.
@@ -1588,7 +1588,7 @@ | |||
"Cases": [ | |||
{ | |||
"SQL": "select t1.a, (select count(t2.a) from t t2 where t2.g in (select t3.d from t t3 where t3.c = t1.a)) as agg_col from t t1;", | |||
"Best": "Apply{IndexReader(Index(t.f)[[NULL,+inf]])->IndexHashJoin{IndexReader(Index(t.c_d_e)[[NULL,+inf]]->HashAgg)->HashAgg->IndexReader(Index(t.g)[[NULL,NULL]])}(test.t.d,test.t.g)}->HashAgg" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected, IndexJoin and IndexHashJoin have no difference in model2, and whether to push the Agg down will be solved by #38874
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 2ddd74d
|
TiDB MergeCI notify🔴 Bad News! New failing [3] after this pr merged.
|
What problem does this PR solve?
Issue Number: ref #35240
Problem Summary: planner: update some UTs from cost model1 to model2
What is changed and how it works?
planner: update some UTs from cost model1 to model2
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.