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

expression:correct comments mistake. #3272

Merged
merged 1 commit into from
May 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion expression/builtin_encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ type builtinUncompressSig struct {
baseBuiltinFunc
}

// This func is used for uncompress a string compiled with a compression library such as zlib.
// uncompress is used for uncompress a string compiled with a compression library such as zlib.
func uncompress(compressStr []byte) ([]byte, error) {
reader := bytes.NewReader(compressStr)
var out bytes.Buffer
Expand Down
10 changes: 5 additions & 5 deletions expression/typeinferer.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ func (v *typeInferrer) handleFuncCallExpr(x *ast.FuncCallExpr) {
x.SetType(tp)
}

// The return type of a CASE expression is the compatible aggregated type of all return values,
// handleCaseExpr decides the return type of a CASE expression which is the compatible aggregated type of all return values,
// but also depends on the context in which it is used.
// If used in a string context, the result is returned as a string.
// If used in a numeric context, the result is returned as a decimal, real, or integer value.
Expand All @@ -469,23 +469,23 @@ func (v *typeInferrer) handleCaseExpr(x *ast.CaseExpr) {
x.SetType(tp)
}

// like expression expects the target expression and pattern to be a string, if it's not, we add a cast function.
// handleLikeExpr expects the target expression and pattern to be a string, if it's not, we add a cast function.
func (v *typeInferrer) handleLikeExpr(x *ast.PatternLikeExpr) {
x.SetType(types.NewFieldType(mysql.TypeLonglong))
types.SetBinChsClnFlag(&x.Type)
x.Expr = v.addCastToString(x.Expr)
x.Pattern = v.addCastToString(x.Pattern)
}

// regexp expression expects the target expression and pattern to be a string, if it's not, we add a cast function.
// handleRegexpExpr expects the target expression and pattern to be a string, if it's not, we add a cast function.
func (v *typeInferrer) handleRegexpExpr(x *ast.PatternRegexpExpr) {
x.SetType(types.NewFieldType(mysql.TypeLonglong))
types.SetBinChsClnFlag(&x.Type)
x.Expr = v.addCastToString(x.Expr)
x.Pattern = v.addCastToString(x.Pattern)
}

// AddCastToString adds a cast function to string type if the expr charset is not UTF8.
// addCastToString adds a cast function to string type if the expr charset is not UTF8.
func (v *typeInferrer) addCastToString(expr ast.ExprNode) ast.ExprNode {
if !mysql.IsUTF8Charset(expr.GetType().Charset) {
castTp := types.NewFieldType(mysql.TypeString)
Expand All @@ -509,7 +509,7 @@ func (v *typeInferrer) addCastToString(expr ast.ExprNode) ast.ExprNode {
return expr
}

// ConvertValueToColumnTypeIfNeeded checks if the expr in PatternInExpr is column name,
// convertValueToColumnTypeIfNeeded checks if the expr in PatternInExpr is column name,
// and casts function to the items in the list.
func (v *typeInferrer) convertValueToColumnTypeIfNeeded(x *ast.PatternInExpr) {
if cn, ok := x.Expr.(*ast.ColumnNameExpr); ok && cn.Refer != nil {
Expand Down