Skip to content
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

builtin: add oct built-in function #2835

Merged
merged 16 commits into from
Mar 17, 2017
Merged

builtin: add oct built-in function #2835

merged 16 commits into from
Mar 17, 2017

Conversation

silenceper
Copy link
Contributor

No description provided.

@CLAassistant
Copy link

CLAassistant commented Mar 15, 2017

CLA assistant check
All committers have signed the CLA.

@@ -404,6 +404,8 @@ func (v *typeInferrer) handleFuncCallExpr(x *ast.FuncCallExpr) {
tp = types.NewFieldType(mysql.TypeVarString)
chs = v.defaultCharset
tp.Flen = 40
case ast.Oct:
tp = types.NewFieldType(mysql.TypeVarString)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please set charset.

{"20", "24"},
{"100", "144"},
{"1024", "2000"},
{"2048", "4000"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add cases for different origin types like integer and float.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, add some negative numbers

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a string that is larger than max uint64.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.
should output the maximum value after exceeding unint64.

@silenceper
Copy link
Contributor Author

fixed and please review again.
@coocood

negative = true
n = n[1:]
}
val, err := strconv.ParseUint(n, 10, 64)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error is discarded.

@coocood
Copy link
Member

coocood commented Mar 16, 2017

LGTM
Thank you for your PR!

@@ -406,6 +406,9 @@ func (v *typeInferrer) handleFuncCallExpr(x *ast.FuncCallExpr) {
tp = types.NewFieldType(mysql.TypeVarString)
chs = v.defaultCharset
tp.Flen = 40
case ast.Oct:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can put this case to line 374.

@XuHuaiyu
Copy link
Contributor

@silenceper
If possible, please check and register the builtin function you decide to implement in issue to let others know, thank you!

@zimulala
Copy link
Contributor

LGTM

@zimulala zimulala merged commit 826ce6f into pingcap:master Mar 17, 2017
@sre-bot sre-bot added the contribution This PR is from a community contributor. label Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants