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: remove inferType interface of functionClass #3518

Merged
merged 3 commits into from
Jun 21, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions expression/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,16 +451,10 @@ func (b *baseFunctionClass) verifyArgs(args []Expression) error {
return nil
}

func (b *baseFunctionClass) inferType(args []Expression) *types.FieldType {
return nil
}

// functionClass is the interface for a function which may contains multiple functions.
type functionClass interface {
// getFunction gets a function signature by the types and the counts of given arguments.
getFunction(args []Expression, ctx context.Context) (builtinFunc, error)
// inferType infers the return type of a function.
inferType(args []Expression) *types.FieldType
}

// BuiltinFunc is the function signature for builtin functions
Expand Down
2 changes: 1 addition & 1 deletion expression/builtin_string_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ func (s *testEvaluatorSuite) TestConcat(c *C) {
}
}

fc := funcs[fcName]
typeCases := []struct {
args []Expression
retType *types.FieldType
Expand All @@ -170,6 +169,7 @@ func (s *testEvaluatorSuite) TestConcat(c *C) {
&types.FieldType{Tp: mysql.TypeBlob, Charset: charset.CharsetBin, Collate: charset.CollationBin, Flag: mysql.BinaryFlag},
},
}
fc := funcs[fcName].(*concatFunctionClass)
for _, t := range typeCases {
retType := fc.inferType(t.args)
c.Assert(retType.Tp, Equals, t.retType.Tp)
Expand Down