From 0fed9dbc5efa9f8a7e82cbfe7cea27cb54812948 Mon Sep 17 00:00:00 2001 From: c-wind Date: Sat, 5 Mar 2016 11:30:06 +0800 Subject: [PATCH 1/2] ddl: fixed test bug --- ddl/column_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ddl/column_test.go b/ddl/column_test.go index 11253c48eb..9f882f20c9 100644 --- a/ddl/column_test.go +++ b/ddl/column_test.go @@ -268,7 +268,7 @@ func (s *testColumnSuite) checkColumnKVExist(c *C, ctx context.Context, t table. c.Assert(err1, IsNil) value, err1 := v.ConvertTo(&col.FieldType) c.Assert(err1, IsNil) - c.Assert(value, Equals, columnValue) + c.Assert(value.GetValue(), Equals, columnValue) } else { c.Assert(err, NotNil) } From f1db0e42eff6709a872959d94dfa771aa625dfa7 Mon Sep 17 00:00:00 2001 From: shenli Date: Tue, 8 Mar 2016 15:53:50 +0800 Subject: [PATCH 2/2] types: Fix i386 float to uint error uint64(float64(-1)) will be 0. So we cast float64 to int64 first. --- util/types/convert.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/types/convert.go b/util/types/convert.go index abb0d41e5b..9ea9a7e063 100644 --- a/util/types/convert.go +++ b/util/types/convert.go @@ -178,7 +178,7 @@ func convertUintToUint(val uint64, upperBound uint64, tp byte) (uint64, error) { func convertFloatToUint(val float64, upperBound uint64, tp byte) (uint64, error) { val = RoundFloat(val) if val < 0 { - return uint64(val), overflow(val, tp) + return uint64(int64(val)), overflow(val, tp) } if val > float64(upperBound) {