-
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
builtin: add oct built-in function #2835
Conversation
plan/typeinferer.go
Outdated
@@ -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) |
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 set charset.
{"20", "24"}, | ||
{"100", "144"}, | ||
{"1024", "2000"}, | ||
{"2048", "4000"}, |
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 add cases for different origin types like integer and float.
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.
Right, add some negative numbers
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 add a string that is larger than max uint64.
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.
fixed.
should output the maximum value after exceeding unint64.
fixed and please review again. |
negative = true | ||
n = n[1:] | ||
} | ||
val, err := strconv.ParseUint(n, 10, 64) |
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 error is discarded.
LGTM |
plan/typeinferer.go
Outdated
@@ -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: |
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.
You can put this case to line 374.
@silenceper |
LGTM |
No description provided.