From a9d0039573130051028b6738f56dec49994bc0a7 Mon Sep 17 00:00:00 2001 From: shenli Date: Mon, 7 Mar 2016 14:26:30 +0800 Subject: [PATCH] *: Add Coerce before compare for PatternInExpr Fix sqllogic test --- evaluator/evaluator.go | 2 +- evaluator/evaluator_test.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/evaluator/evaluator.go b/evaluator/evaluator.go index 7521a6d7ad..751d882587 100644 --- a/evaluator/evaluator.go +++ b/evaluator/evaluator.go @@ -384,7 +384,7 @@ func (e *Evaluator) checkInList(not bool, in interface{}, list []interface{}) in continue } - r, err := types.Compare(in, v) + r, err := types.Compare(types.Coerce(in, v)) if err != nil { e.err = errors.Trace(err) return nil diff --git a/evaluator/evaluator_test.go b/evaluator/evaluator_test.go index 27e2aa17b7..8bca5741f2 100644 --- a/evaluator/evaluator_test.go +++ b/evaluator/evaluator_test.go @@ -677,6 +677,10 @@ func (s *testEvaluatorSuite) TestPatternIn(c *C) { exprStr: "2 in (1, NULL)", resultStr: "", }, + { + exprStr: "(-(23)++46/51*+51) in (+23)", + resultStr: "0", + }, } s.runTests(c, cases) }