-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
*: add builtin aggregate function var_pop
#11155
Conversation
root seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
…cap#11114) Signed-off-by: H-ZeX <hzx20112012@gmail.com>
Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
…11032) Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
@githubFZX Thanks for your contribution, please follow the Contribution Guide to add a proper PR title. |
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Okay, thank you for your guidance and wish you have a happy life.
…------------------ 原始邮件 ------------------
发件人: "Zhang Jian"<notifications@github.com>;
发送时间: 2019年7月17日(星期三) 下午5:35
收件人: "pingcap/tidb"<tidb@noreply.github.com>;
抄送: "1411679031"<1411679031@qq.com>;"Mention"<mention@noreply.github.com>;
主题: Re: [pingcap/tidb] Add var_pop (#11155)
@githubFZX Thanks for your contribution, please follow the Contribution Guide to add a proper PR title.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
…inconsistent 0 results. (pingcap#11251)
/run-all-tests |
@githubFZX please sign the CLA. Ref to #11155 (comment) |
@@ -344,11 +352,11 @@ func (s *testSuite1) TestAggregation(c *C) { | |||
_, err = tk.Exec("select std_samp(a) from t") | |||
// TODO: Fix this error message. | |||
c.Assert(errors.Cause(err).Error(), Equals, "[expression:1305]FUNCTION std_samp does not exist") | |||
_, err = tk.Exec("select variance(a) from t") | |||
//_, err = tk.Exec("select variance(a) from t") | |||
//c.Assert(errors.Cause(err).Error(), Equals, "unsupported agg function: variance") |
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.
please do not comment them out, you can simply rewrite the expected behavior of this test.
_, err = tk.Exec("select var_pop(a) from t") | ||
c.Assert(errors.Cause(err).Error(), Equals, "unsupported agg function: var_pop") | ||
//_, err = tk.Exec("select var_pop(a) from t") | ||
//c.Assert(errors.Cause(err).Error(), Equals, "unsupported agg function: var_pop") |
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.
ditto
@@ -233,6 +235,12 @@ func (a *baseFuncDesc) typeInfer4LeadLag(ctx sessionctx.Context) { | |||
} | |||
} | |||
|
|||
func (a *baseFuncDesc) typeInfer4VarPop(ctx sessionctx.Context) { | |||
//var_pop's return value type is double |
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.
//var_pop's return value type is double | |
// var_pop's return value type is double |
It's recommended to add a space between //
and the first word.
baseAggFunc | ||
} | ||
|
||
type partialResult4Float64 struct { |
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.
It's better to use the algorithm described by Chan, Golub, and LeVeque in "Algorithms for computing the sample variance: analysis and recommendations" to calculate the variance. You can find how apache hive implement this at here: https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFVariance.java#L194
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.
Okay. I will refer to it.
@githubFZX friendly ping, any update? |
What problem does this PR solve?
#7623
Tests