Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
  • Loading branch information
wjhuang2016 committed Aug 13, 2020
1 parent 9b26ed5 commit 8666e5b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions planner/core/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,14 +711,6 @@ func finishCopTask(ctx sessionctx.Context, task task) task {
if !ok {
return task
}
if t.tablePlan != nil {
tp := t.tablePlan
for len(tp.Children()) > 0 {
tp = tp.Children()[0]
}
ts := tp.(*PhysicalTableScan)
ts.Columns = ExpandVirtualColumn(ts.Columns, ts.schema, ts.Table.Columns)
}
sessVars := ctx.GetSessionVars()
// copTasks are run in parallel, to make the estimated cost closer to execution time, we amortize
// the cost to cop iterator workers. According to `CopClient::Send`, the concurrency
Expand All @@ -729,6 +721,18 @@ func finishCopTask(ctx sessionctx.Context, task task) task {
// Network cost of transferring rows of table scan to TiDB.
if t.tablePlan != nil {
t.cst += t.count() * sessVars.NetworkFactor * t.tblColHists.GetAvgRowSize(ctx, t.tablePlan.Schema().Columns, false, false)

tp := t.tablePlan
for len(tp.Children()) > 0 {
if len(tp.Children()) == 1 {
tp = tp.Children()[0]
} else {
join := tp.(*PhysicalBroadCastJoin)
tp = join.children[1-join.InnerChildIdx]
}
}
ts := tp.(*PhysicalTableScan)
ts.Columns = ExpandVirtualColumn(ts.Columns, ts.schema, ts.Table.Columns)
}
t.cst /= copIterWorkers
newTask := &rootTask{
Expand Down

0 comments on commit 8666e5b

Please sign in to comment.