-
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: consider agg func type in cost model #12038
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12038 +/- ##
===========================================
Coverage 81.5318% 81.5318%
===========================================
Files 448 448
Lines 96198 96198
===========================================
Hits 78432 78432
Misses 12192 12192
Partials 5574 5574 |
planner/core/task.go
Outdated
if numAggFunc == 0 { | ||
numAggFunc = 1 | ||
aggFactorSum := 0.0 | ||
for _, agg := range p.AggFuncs { |
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.
Why not extract a function for them?
planner/core/task.go
Outdated
} | ||
} | ||
if aggFactorSum == 0 { | ||
aggFactorSum = 1.0 |
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.
So no agg func has more cost that single bitXXX
? That seems weird.
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.
My opinion is that bit operation costs lower than other base operations.
@@ -43,6 +44,24 @@ const ( | |||
distinctFactor = 0.8 | |||
) | |||
|
|||
var aggFuncFactor = map[string]float64{ | |||
ast.AggFuncCount: 1.0, |
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.
How do you dicide their values?
And what is defalut
for?
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.
- The values are how they keep the result of their arguments. For example:
avg: avg.sum += expr, avg.cnt += 1
var_pop: var_pop.sum_sqr += expr*expr, var_pop.cnt += 1, var_pop.sum += expr
- The
default
is just for safety.
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.
LGTM
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.
lgtm
Your auto merge job has been accepted, waiting for #12092 |
/run-all-tests |
What problem does this PR solve?
After PR #11926. We found that aggregation didn't push to cop task for TPCH Q1. The reason is explained by issue #11948. This PR changes the cost model to consider agg function types simply.
What is changed and how it works?
Add factor for each agg function instead of the number of agg functions.
Check List
Tests
Side effects