Repository: matrixorigin/matrixone
Pull request #2856 (2022-06-08 03:33:17)

datetime support fsp
**What type of PR is this?**

- [ ] API-change
- [ ] BUG
- [x] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

**Which issue(s) this PR fixes:**

issue #2490 

**What this PR does / why we need it:**

Not Available

**Special notes for your reviewer:**

Not Available

**Additional documentation (e.g. design docs, usage docs, etc.):**

Not Available



Patch:
diff --git a/go.mod b/go.mod
index 4568fc5e7..da4041b36 100644
--- a/go.mod
+++ b/go.mod
@@ -21,7 +21,7 @@ require (
 	github.com/golang/mock v1.6.0
 	github.com/google/btree v1.0.1
 	github.com/google/gofuzz v1.2.0
-	github.com/lni/dragonboat/v4 v4.0.0-20220604123758-e40bf3f57b59
+	github.com/lni/dragonboat/v4 v4.0.0-20220612172217-6ae1d0b2e535
 	github.com/lni/goutils v1.3.1-0.20220604063047-388d67b4dbc4
 	github.com/matrixorigin/matrixcube v0.3.1-0.20220606032431-c944d801f1e5
 	github.com/matrixorigin/simdcsv v0.0.0-20210926114300-591bf748a770
diff --git a/go.sum b/go.sum
index f4a75cda9..b3f27f718 100644
--- a/go.sum
+++ b/go.sum
@@ -472,8 +472,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
 github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g=
 github.com/labstack/echo/v4 v4.5.0/go.mod h1:czIriw4a0C1dFun+ObrXp7ok03xON0N1awStJ6ArI7Y=
 github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
-github.com/lni/dragonboat/v4 v4.0.0-20220604123758-e40bf3f57b59 h1:QQnr5/JOG9upSf0WXP6LVg18vBlbycJbY5egnpyWcKQ=
-github.com/lni/dragonboat/v4 v4.0.0-20220604123758-e40bf3f57b59/go.mod h1:5dd7hX8qUJ+72UVKdZZIBw5UbhZTaGY5PIt/TTdIeSY=
+github.com/lni/dragonboat/v4 v4.0.0-20220612172217-6ae1d0b2e535 h1:tjaMFsEucNN3tOkzT6FHxEWJQZW0skBmK7CXR25bVHo=
+github.com/lni/dragonboat/v4 v4.0.0-20220612172217-6ae1d0b2e535/go.mod h1:5dd7hX8qUJ+72UVKdZZIBw5UbhZTaGY5PIt/TTdIeSY=
 github.com/lni/goutils v1.3.0/go.mod h1:PUPtBAnZlRPUKWUXCsYkIRWubJbtNHpTAee0sczhlf4=
 github.com/lni/goutils v1.3.1-0.20220604063047-388d67b4dbc4 h1:6gzI38ZJmbzZ7oZebXz6jII0uVK+MZ3+ds+7mIt1ioI=
 github.com/lni/goutils v1.3.1-0.20220604063047-388d67b4dbc4/go.mod h1:LIHvF0fflR+zyXUQFQOiHPpKANf3UIr7DFIv5CBPOoU=
diff --git a/pkg/container/types/datetime.go b/pkg/container/types/datetime.go
index dfafda6d5..f38770b22 100644
--- a/pkg/container/types/datetime.go
+++ b/pkg/container/types/datetime.go
@@ -16,8 +16,6 @@ package types
 
 import (
 	"fmt"
-	"math"
-	"strconv"
 	gotime "time"
 	"unsafe"
 
@@ -36,18 +34,6 @@ const (
 // The higher 44 bits holds number of seconds since January 1, year 1 in Gregorian
 // calendar, and lower 20 bits holds number of microseconds
 
-func (dt Datetime) String() string {
-	// when datetime have microsecond, we print it, default precision is 6
-	y, m, d, _ := dt.ToDate().Calendar(true)
-	hour, minute, sec := dt.Clock()
-	msec := int64(dt) & microSecondBitMask
-	if msec > 0 {
-		msecInstr := fmt.Sprintf("%06d", msec)
-		return fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d"+"."+msecInstr, y, m, d, hour, minute, sec)
-	}
-	return fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d", y, m, d, hour, minute, sec)
-}
-
 const (
 	//tsMask         = ^uint64(0) >> 1
 	hasMonotonic = 1 << 63
@@ -63,14 +49,37 @@ var (
 	errIncorrectDatetimeValue = errors.New(errno.DataException, "Incorrect datetime value")
 )
 
+func (dt Datetime) String() string {
+	y, m, d, _ := dt.ToDate().Calendar(true)
+	hour, minute, sec := dt.Clock()
+	return fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d", y, m, d, hour, minute, sec)
+}
+
+func (dt Datetime) String2(precision int32) string {
+	y, m, d, _ := dt.ToDate().Calendar(true)
+	hour, minute, sec := dt.Clock()
+	if precision > 0 {
+		msec := int64(dt) & 0xfffff
+		msecInstr := fmt.Sprintf("%06d\n", msec)
+		msecInstr = msecInstr[:precision]
+
+		return fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d"+"."+msecInstr, y, m, d, hour, minute, sec)
+	}
+	return fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d", y, m, d, hour, minute, sec)
+}
+
 // ParseDatetime will parse a string to be a Datetime
 // Support Format:
 // 1. all the Date value
 // 2. yyyy-mm-dd hh:mm:ss(.msec)
 // 3. yyyymmddhhmmss(.msec)
-// Notice: 2022-01-01 00:00:00.1 and 20220101000000.1 should parse to 100000 microsecond instead of 1 microsecond
-// I call the situation is microsecond number bug
-func ParseDatetime(s string) (Datetime, error) {
+// during parsing, the Datetime value will be rounded(away from zero) to the predefined precision, for example:
+// Datetime(3) input string   					parsing result
+// 				"1999-09-09 11:11:11.1234"		"1999-09-09 11:11:11.123"
+//				"1999-09-09 11:11:11.1235"		"1999-09-09 11:11:11.124"
+// 				"1999-09-09 11:11:11.9994"      "1999-09-09 11:11:11.999"
+// 				"1999-09-09 11:11:11.9995"      "1999-09-09 11:11:12.000"
+func ParseDatetime(s string, precision int32) (Datetime, error) {
 	if len(s) < 14 {
 		if d, err := ParseDate(s); err == nil {
 			return d.ToTime(), nil
@@ -80,6 +89,8 @@ func ParseDatetime(s string) (Datetime, error) {
 	var year int32
 	var month, day, hour, minute, second uint8
 	var msec uint32 = 0
+	var carry uint32 = 0
+	var err error
 
 	year = int32(s[0]-'0')*1000 + int32(s[1]-'0')*100 + int32(s[2]-'0')*10 + int32(s[3]-'0')
 	if s[4] == '-' {
@@ -111,13 +122,11 @@ func ParseDatetime(s string) (Datetime, error) {
 		}
 		if len(s) > 19 {
 			if len(s) > 20 && s[19] == '.' {
-				m, err := strconv.ParseUint(s[20:], 10, 32)
+				msecStr := s[20:]
+				msec, carry, err = getMsec(msecStr, precision)
 				if err != nil {
 					return -1, errIncorrectDatetimeValue
 				}
-				// fix microsecond number bug
-				m = m * uint64(math.Pow10(26-len(s)))
-				msec = uint32(m)
 			} else {
 				return -1, errIncorrectDatetimeValue
 			}
@@ -130,19 +139,18 @@ func ParseDatetime(s string) (Datetime, error) {
 		second = (s[12]-'0')*10 + (s[13] - '0')
 		if len(s) > 14 {
 			if len(s) > 15 && s[14] == '.' {
-				m, err := strconv.ParseUint(s[15:], 10, 32)
+				msecStr := s[15:]
+				msec, carry, err = getMsec(msecStr, precision)
 				if err != nil {
 					return -1, errIncorrectDatetimeValue
 				}
-				// fix microsecond number bug
-				m = m * uint64(math.Pow10(21-len(s)))
-				msec = uint32(m)
 			} else {
 				return -1, errIncorrectDatetimeValue
 			}
 		}
 	}
-	return FromClock(year, month, day, hour, minute, second, msec), nil
+	result := FromClock(year, month, day, hour, minute, second+uint8(carry), msec)
+	return result, nil
 }
 
 // validTimeInDay return true if hour, minute and second can be a time during a day
diff --git a/pkg/frontend/insert.go b/pkg/frontend/insert.go
index 321e1a37b..db1a4508c 100644
--- a/pkg/frontend/insert.go
+++ b/pkg/frontend/insert.go
@@ -1000,7 +1000,7 @@ func buildConstantValue(typ types.Type, num *tree.NumVal) (interface{}, error) {
 			}
 		case types.T_datetime:
 			if !num.Negative() {
-				return types.ParseDatetime(str)
+				return types.ParseDatetime(str, typ.Precision)
 			}
 		}
 	case constant.Float:
@@ -1060,7 +1060,7 @@ func buildConstantValue(typ types.Type, num *tree.NumVal) (interface{}, error) {
 			}
 			return float64(v), nil
 		case types.T_datetime:
-			return types.ParseDatetime(str)
+			return types.ParseDatetime(str, typ.Precision)
 		case types.T_decimal64:
 			return types.ParseStringToDecimal64(str, typ.Width, typ.Scale)
 		case types.T_decimal128:
@@ -1080,7 +1080,7 @@ func buildConstantValue(typ types.Type, num *tree.NumVal) (interface{}, error) {
 			case types.T_date:
 				return types.ParseDate(constant.StringVal(val))
 			case types.T_datetime:
-				return types.ParseDatetime(constant.StringVal(val))
+				return types.ParseDatetime(constant.StringVal(val), typ.Precision)
 			case types.T_timestamp:
 				return types.ParseTimestamp(constant.StringVal(val), typ.Precision)
 			}
diff --git a/pkg/frontend/load.go b/pkg/frontend/load.go
index b2bd012f7..835ede72c 100644
--- a/pkg/frontend/load.go
+++ b/pkg/frontend/load.go
@@ -1006,7 +1006,7 @@ func rowToColumnAndSaveToStorage(handler *WriteBatchHandler, forceConvert bool,
 						nulls.Add(vec.Nsp, uint64(rowIdx))
 					} else {
 						fs := field
-						d, err := types.ParseDatetime(fs)
+						d, err := types.ParseDatetime(fs, vec.Typ.Precision)
 						if err != nil {
 							logutil.Errorf("parse field[%v] err:%v", field, err)
 							if !ignoreFieldError {
@@ -1487,7 +1487,7 @@ func rowToColumnAndSaveToStorage(handler *WriteBatchHandler, forceConvert bool,
 					} else {
 						field := line[j]
 						//logutil.Infof("==== > field string [%s] ",fs)
-						d, err := types.ParseDatetime(field)
+						d, err := types.ParseDatetime(field, vec.Typ.Precision)
 						if err != nil {
 							logutil.Errorf("parse field[%v] err:%v", field, err)
 							if !ignoreFieldError {
diff --git a/pkg/frontend/mysql_cmd_executor.go b/pkg/frontend/mysql_cmd_executor.go
index b4999d139..d49897b80 100644
--- a/pkg/frontend/mysql_cmd_executor.go
+++ b/pkg/frontend/mysql_cmd_executor.go
@@ -456,15 +456,16 @@ func getDataFromPipeline(obj interface{}, bat *batch.Batch) error {
 					}
 				}
 			case types.T_datetime:
+				precision := vec.Typ.Precision
 				if !nulls.Any(vec.Nsp) { //all data in this column are not null
 					vs := vec.Col.([]types.Datetime)
-					row[i] = vs[rowIndex]
+					row[i] = vs[rowIndex].String2(precision)
 				} else {
 					if nulls.Contains(vec.Nsp, uint64(rowIndex)) { //is null
 						row[i] = nil
 					} else {
 						vs := vec.Col.([]types.Datetime)
-						row[i] = vs[rowIndex]
+						row[i] = vs[rowIndex].String2(precision)
 					}
 				}
 			case types.T_timestamp:
@@ -498,6 +499,7 @@ func getDataFromPipeline(obj interface{}, bat *batch.Batch) error {
 				if !nulls.Any(vec.Nsp) { //all data in this column are not null
 					vs := vec.Col.([]types.Decimal128)
 					row[i] = vs[rowIndex].Decimal128ToString(scale)
+					fmt.Println(row[i])
 				} else {
 					if nulls.Contains(vec.Nsp, uint64(rowIndex)) {
 						row[i] = nil
diff --git a/pkg/frontend/mysql_protocol.go b/pkg/frontend/mysql_protocol.go
index 480f04d1b..b2357e750 100644
--- a/pkg/frontend/mysql_protocol.go
+++ b/pkg/frontend/mysql_protocol.go
@@ -1321,10 +1321,10 @@ func (mp *MysqlProtocolImpl) makeResultSetTextRow(data []byte, mrs *MysqlResultS
 				data = mp.appendStringLenEnc(data, value.(types.Date).String())
 			}
 		case defines.MYSQL_TYPE_DATETIME:
-			if value, err2 := mrs.GetValue(r, i); err2 != nil {
+			if value, err2 := mrs.GetString(r, i); err2 != nil {
 				return nil, err2
 			} else {
-				data = mp.appendStringLenEnc(data, value.(types.Datetime).String())
+				data = mp.appendStringLenEnc(data, value)
 			}
 		case defines.MYSQL_TYPE_TIMESTAMP:
 			if value, err2 := mrs.GetString(r, i); err2 != nil {
diff --git a/pkg/frontend/resultset.go b/pkg/frontend/resultset.go
index 490c60570..801684ed9 100644
--- a/pkg/frontend/resultset.go
+++ b/pkg/frontend/resultset.go
@@ -16,6 +16,7 @@ package frontend
 
 import (
 	"fmt"
+	"github.com/matrixorigin/matrixone/pkg/container/types"
 	"strconv"
 
 	"github.com/matrixorigin/matrixone/pkg/defines"
@@ -206,6 +207,10 @@ func (mc *MysqlColumn) IsSigned() bool {
 	return mc.flag&uint16(defines.UNSIGNED_FLAG) == 0
 }
 
+// Discussion: for some MatrixOne types, the Type.Precision and Type.Scale value are needed for stringification, I think we
+// need to add a field
+// MoTypes []types.Type
+// in this struct, what's your opinion on this matter?@Daviszhen
 type MysqlResultSet struct {
 	//column information
 	Columns []Column
@@ -480,6 +485,8 @@ func (mrs *MysqlResultSet) GetString(rindex, cindex uint64) (string, error) {
 		return strconv.FormatInt(int64(v), 10), nil
 	case uint:
 		return strconv.FormatUint(uint64(v), 10), nil
+	case types.Datetime:
+		return v.String(), nil
 	default:
 		return "", fmt.Errorf("unsupported type %d ", v)
 	}
diff --git a/pkg/frontend/util.go b/pkg/frontend/util.go
index 92a29494a..2af8cc55d 100644
--- a/pkg/frontend/util.go
+++ b/pkg/frontend/util.go
@@ -686,7 +686,7 @@ func FillBatchWithData(data [][]string, batch *batch.Batch) {
 					nulls.Add(vec.Nsp, uint64(rowIdx))
 				} else {
 					fs := field
-					d, err := types.ParseDatetime(fs)
+					d, err := types.ParseDatetime(fs, vec.Typ.Precision)
 					if err != nil {
 						logutil.Errorf("parse field[%v] err:%v", field, err)
 						d = 0
diff --git a/pkg/hakeeper/state.go b/pkg/hakeeper/state.go
index f7bcccb20..8ae14f95b 100644
--- a/pkg/hakeeper/state.go
+++ b/pkg/hakeeper/state.go
@@ -26,8 +26,8 @@ const (
 	NoLeader uint64 = 0
 )
 
-// DNShardInfo contins information on a list of shards.
-type DNShardInfo struct {
+// DNStoreInfo contins information on a list of shards.
+type DNStoreInfo struct {
 	Tick   uint64
 	Shards []logservice.DNShardInfo
 }
@@ -35,14 +35,14 @@ type DNShardInfo struct {
 // DNState contains all DN details known to the HAKeeper.
 type DNState struct {
 	// Stores is keyed by DN store UUID, it contains details found on each DN
-	// store.
-	Stores map[string]DNShardInfo
+	// store. Each DNStoreInfo reflects what was last reported by each DN store.
+	Stores map[string]DNStoreInfo
 }
 
 // NewDNState creates a new DNState.
 func NewDNState() DNState {
 	return DNState{
-		Stores: make(map[string]DNShardInfo),
+		Stores: make(map[string]DNStoreInfo),
 	}
 }
 
@@ -50,17 +50,17 @@ func NewDNState() DNState {
 // current tick of the HAKeeper which can be used as the timestamp of the
 // heartbeat.
 func (s *DNState) Update(hb logservice.DNStoreHeartbeat, tick uint64) {
-	shardInfo, ok := s.Stores[hb.UUID]
+	storeInfo, ok := s.Stores[hb.UUID]
 	if !ok {
-		shardInfo = DNShardInfo{}
+		storeInfo = DNStoreInfo{}
 	}
-	shardInfo.Tick = tick
-	shardInfo.Shards = hb.Shards
-	s.Stores[hb.UUID] = shardInfo
+	storeInfo.Tick = tick
+	storeInfo.Shards = hb.Shards
+	s.Stores[hb.UUID] = storeInfo
 }
 
-// LogShardInfo contains information of all replicas found on a Log store.
-type LogShardInfo struct {
+// LogStoreInfo contains information of all replicas found on a Log store.
+type LogStoreInfo struct {
 	Tick           uint64
 	RaftAddress    string
 	ServiceAddress string
@@ -75,15 +75,15 @@ type LogState struct {
 	// shard.
 	Shards map[uint64]logservice.LogShardInfo
 	// Stores is keyed by log store UUID, it contains details found on each store.
-	// Each LogShardInfo here reflects what was last reported by each Log store.
-	Stores map[string]LogShardInfo
+	// Each LogStoreInfo here reflects what was last reported by each Log store.
+	Stores map[string]LogStoreInfo
 }
 
 // NewLogState creates a new LogState.
 func NewLogState() LogState {
 	return LogState{
 		Shards: make(map[uint64]logservice.LogShardInfo),
-		Stores: make(map[string]LogShardInfo),
+		Stores: make(map[string]LogStoreInfo),
 	}
 }
 
@@ -95,16 +95,16 @@ func (s *LogState) Update(hb logservice.LogStoreHeartbeat, tick uint64) {
 }
 
 func (s *LogState) updateStores(hb logservice.LogStoreHeartbeat, tick uint64) {
-	shardInfo, ok := s.Stores[hb.UUID]
+	storeInfo, ok := s.Stores[hb.UUID]
 	if !ok {
-		shardInfo = LogShardInfo{}
+		storeInfo = LogStoreInfo{}
 	}
-	shardInfo.Tick = tick
-	shardInfo.RaftAddress = hb.RaftAddress
-	shardInfo.ServiceAddress = hb.ServiceAddress
-	shardInfo.GossipAddress = hb.GossipAddress
-	shardInfo.Shards = hb.Shards
-	s.Stores[hb.UUID] = shardInfo
+	storeInfo.Tick = tick
+	storeInfo.RaftAddress = hb.RaftAddress
+	storeInfo.ServiceAddress = hb.ServiceAddress
+	storeInfo.GossipAddress = hb.GossipAddress
+	storeInfo.Shards = hb.Shards
+	s.Stores[hb.UUID] = storeInfo
 }
 
 func (s *LogState) updateShards(hb logservice.LogStoreHeartbeat) {
diff --git a/pkg/logservice/client.go b/pkg/logservice/client.go
index dbcd10412..18a6da867 100644
--- a/pkg/logservice/client.go
+++ b/pkg/logservice/client.go
@@ -27,6 +27,14 @@ var (
 	ErrIncompatibleClient = moerr.NewError(moerr.INVALID_INPUT, "incompatible client")
 )
 
+// IsTempError returns a boolean value indicating whether the specified error is a temp
+// error that worth to be retried, e.g. timeouts, temp network issues, operation can be
+// completed as Raft leader is being elected. Non-temp error means the error is caused
+// by program logics rather than some external factors.
+func IsTempError(err error) bool {
+	return isTempError(err)
+}
+
 type LogServiceClientConfig struct {
 	ReadOnly  bool
 	ShardID   uint64
diff --git a/pkg/logservice/errors.go b/pkg/logservice/errors.go
index 2bdddaeb8..1d7b3f6d3 100644
--- a/pkg/logservice/errors.go
+++ b/pkg/logservice/errors.go
@@ -15,6 +15,8 @@
 package logservice
 
 import (
+	"net"
+
 	"github.com/cockroachdb/errors"
 	"github.com/lni/dragonboat/v4"
 
@@ -45,10 +47,10 @@ func getErrorToCodeMapping() []errorToCode {
 		{dragonboat.ErrShardNotReady, pb.ErrorCode_ShardNotReady, true},
 		{dragonboat.ErrSystemBusy, pb.ErrorCode_ShardNotReady, false},
 		{dragonboat.ErrClosed, pb.ErrorCode_SystemClosed, true},
+		{dragonboat.ErrInvalidRange, pb.ErrorCode_OutOfRange, true},
 
 		{ErrInvalidTruncateIndex, pb.ErrorCode_IndexAlreadyTruncated, true},
 		{ErrNotLeaseHolder, pb.ErrorCode_NotLeaseHolder, true},
-		{ErrOutOfRange, pb.ErrorCode_OutOfRange, true},
 	}
 }
 
@@ -83,3 +85,13 @@ func toError(resp pb.Response) error {
 	// will never reach here
 	return nil
 }
+
+func isTempError(err error) bool {
+	if dragonboat.IsTempError(err) {
+		return true
+	}
+	if _, ok := err.(net.Error); ok {
+		return true
+	}
+	return false
+}
diff --git a/pkg/logservice/service.go b/pkg/logservice/service.go
index 900df86c6..e09367b8a 100644
--- a/pkg/logservice/service.go
+++ b/pkg/logservice/service.go
@@ -141,7 +141,7 @@ func (s *Service) serve(conn net.Conn) {
 				}
 				return
 			}
-			if errors.Is(err, ErrBadMessage) {
+			if errors.Is(err, errBadMessage) {
 				return
 			}
 			operr, ok := err.(net.Error)
diff --git a/pkg/logservice/store.go b/pkg/logservice/store.go
index 4699e5a84..50b2670b9 100644
--- a/pkg/logservice/store.go
+++ b/pkg/logservice/store.go
@@ -35,8 +35,9 @@ import (
 var (
 	ErrInvalidTruncateIndex = moerr.NewError(moerr.INVALID_INPUT, "invalid input")
 	ErrNotLeaseHolder       = moerr.NewError(moerr.INVALID_STATE, "not lease holder")
-	ErrOutOfRange           = moerr.NewError(moerr.INVALID_INPUT, "query out of range")
 	ErrInvalidShardID       = moerr.NewError(moerr.INVALID_INPUT, "invalid shard ID")
+
+	ErrOutOfRange = dragonboat.ErrInvalidRange
 )
 
 type logStoreMeta struct {
diff --git a/pkg/logservice/transport.go b/pkg/logservice/transport.go
index 44ed870af..bc719c467 100644
--- a/pkg/logservice/transport.go
+++ b/pkg/logservice/transport.go
@@ -26,8 +26,7 @@ import (
 )
 
 var (
-	ErrInvalidBuffer   = moerr.NewError(moerr.INVALID_STATE, "invalid buffer size")
-	ErrBadMessage      = moerr.NewError(moerr.INVALID_INPUT, "invalid message")
+	errBadMessage      = moerr.NewError(moerr.INVALID_INPUT, "invalid message")
 	errPoisonReceived  = moerr.NewError(moerr.INVALID_STATE, "poison received")
 	ErrDeadlineNotSet  = moerr.NewError(moerr.INVALID_INPUT, "deadline not set")
 	ErrInvalidDeadline = moerr.NewError(moerr.INVALID_INPUT, "invalid deadline")
@@ -273,7 +272,7 @@ func readMagicNumber(conn net.Conn, buf []byte) error {
 		return errPoisonReceived
 	}
 	if !bytes.Equal(buf, magicNumber[:]) {
-		return ErrBadMessage
+		return errBadMessage
 	}
 	return nil
 }
diff --git a/pkg/pb/metadata/metadata.pb.go b/pkg/pb/metadata/metadata.pb.go
index b38e98107..cca8a473e 100644
--- a/pkg/pb/metadata/metadata.pb.go
+++ b/pkg/pb/metadata/metadata.pb.go
@@ -23,39 +23,35 @@ var _ = math.Inf
 // proto package needs to be updated.
 const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
 
-// DN dn shard metadata
-type DN struct {
-	// ID the id of the DN. The ID is not modified after the DN is created.
-	ID uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
-	// ReplicaID only one replica for one DN. The ReplicaID is specified at
-	// the time the DN is created. DN restart ReplicaID will not change, when
-	// a DN is migrated to another node, the ReplicaID will be reset.
-	ReplicaID uint64 `protobuf:"varint,2,opt,name=replicaID,proto3" json:"replicaID,omitempty"`
+// DNShardRecord is DN shard metadata describing what is a DN shard. It
+// is internally used by HAKeeper to maintain how many DNs available in
+// the system.
+type DNShardRecord struct {
+	// ShardID the id of the DN shard.
+	ShardID uint64 `protobuf:"varint,1,opt,name=ShardID,proto3" json:"ShardID,omitempty"`
 	// LogShardID a DN corresponds to a unique Shard of LogService.
-	LogShardID uint64 `protobuf:"varint,3,opt,name=logShardID,proto3" json:"logShardID,omitempty"`
+	LogShardID uint64 `protobuf:"varint,2,opt,name=LogShardID,proto3" json:"LogShardID,omitempty"`
 	// Start A DN manages data within a range [Start, end)
-	Start []byte `protobuf:"bytes,4,opt,name=start,proto3" json:"start,omitempty"`
+	Start []byte `protobuf:"bytes,3,opt,name=Start,proto3" json:"Start,omitempty"`
 	// End A DN manages data within a range [Start, end)
-	End []byte `protobuf:"bytes,5,opt,name=end,proto3" json:"end,omitempty"`
-	// Address DN external service address.
-	Address              string   `protobuf:"bytes,6,opt,name=address,proto3" json:"address,omitempty"`
+	End                  []byte   `protobuf:"bytes,4,opt,name=End,proto3" json:"End,omitempty"`
 	XXX_NoUnkeyedLiteral struct{} `json:"-"`
 	XXX_unrecognized     []byte   `json:"-"`
 	XXX_sizecache        int32    `json:"-"`
 }
 
-func (m *DN) Reset()         { *m = DN{} }
-func (m *DN) String() string { return proto.CompactTextString(m) }
-func (*DN) ProtoMessage()    {}
-func (*DN) Descriptor() ([]byte, []int) {
+func (m *DNShardRecord) Reset()         { *m = DNShardRecord{} }
+func (m *DNShardRecord) String() string { return proto.CompactTextString(m) }
+func (*DNShardRecord) ProtoMessage()    {}
+func (*DNShardRecord) Descriptor() ([]byte, []int) {
 	return fileDescriptor_56d9f74966f40d04, []int{0}
 }
-func (m *DN) XXX_Unmarshal(b []byte) error {
+func (m *DNShardRecord) XXX_Unmarshal(b []byte) error {
 	return m.Unmarshal(b)
 }
-func (m *DN) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+func (m *DNShardRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
 	if deterministic {
-		return xxx_messageInfo_DN.Marshal(b, m, deterministic)
+		return xxx_messageInfo_DNShardRecord.Marshal(b, m, deterministic)
 	} else {
 		b = b[:cap(b)]
 		n, err := m.MarshalToSizedBuffer(b)
@@ -65,87 +61,210 @@ func (m *DN) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
 		return b[:n], nil
 	}
 }
-func (m *DN) XXX_Merge(src proto.Message) {
-	xxx_messageInfo_DN.Merge(m, src)
+func (m *DNShardRecord) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_DNShardRecord.Merge(m, src)
 }
-func (m *DN) XXX_Size() int {
+func (m *DNShardRecord) XXX_Size() int {
 	return m.Size()
 }
-func (m *DN) XXX_DiscardUnknown() {
-	xxx_messageInfo_DN.DiscardUnknown(m)
+func (m *DNShardRecord) XXX_DiscardUnknown() {
+	xxx_messageInfo_DNShardRecord.DiscardUnknown(m)
 }
 
-var xxx_messageInfo_DN proto.InternalMessageInfo
+var xxx_messageInfo_DNShardRecord proto.InternalMessageInfo
 
-func (m *DN) GetID() uint64 {
+func (m *DNShardRecord) GetShardID() uint64 {
 	if m != nil {
-		return m.ID
+		return m.ShardID
 	}
 	return 0
 }
 
-func (m *DN) GetReplicaID() uint64 {
-	if m != nil {
-		return m.ReplicaID
-	}
-	return 0
-}
-
-func (m *DN) GetLogShardID() uint64 {
+func (m *DNShardRecord) GetLogShardID() uint64 {
 	if m != nil {
 		return m.LogShardID
 	}
 	return 0
 }
 
-func (m *DN) GetStart() []byte {
+func (m *DNShardRecord) GetStart() []byte {
 	if m != nil {
 		return m.Start
 	}
 	return nil
 }
 
-func (m *DN) GetEnd() []byte {
+func (m *DNShardRecord) GetEnd() []byte {
 	if m != nil {
 		return m.End
 	}
 	return nil
 }
 
-func (m *DN) GetAddress() string {
+// DNShard
+type DNShard struct {
+	// DNShard extends DNShardRecord
+	DNShardRecord `protobuf:"bytes,1,opt,name=DNShardRecord,proto3,embedded=DNShardRecord" json:"DNShardRecord"`
+	// ReplicaID only one replica for one DN. The ReplicaID is specified at
+	// the time the DN is created. DN restart ReplicaID will not change, when
+	// a DN is migrated to another node, the ReplicaID will be reset.
+	ReplicaID uint64 `protobuf:"varint,2,opt,name=ReplicaID,proto3" json:"ReplicaID,omitempty"`
+	// Address is DN's external service address.
+	Address              string   `protobuf:"bytes,3,opt,name=Address,proto3" json:"Address,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *DNShard) Reset()         { *m = DNShard{} }
+func (m *DNShard) String() string { return proto.CompactTextString(m) }
+func (*DNShard) ProtoMessage()    {}
+func (*DNShard) Descriptor() ([]byte, []int) {
+	return fileDescriptor_56d9f74966f40d04, []int{1}
+}
+func (m *DNShard) XXX_Unmarshal(b []byte) error {
+	return m.Unmarshal(b)
+}
+func (m *DNShard) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	if deterministic {
+		return xxx_messageInfo_DNShard.Marshal(b, m, deterministic)
+	} else {
+		b = b[:cap(b)]
+		n, err := m.MarshalToSizedBuffer(b)
+		if err != nil {
+			return nil, err
+		}
+		return b[:n], nil
+	}
+}
+func (m *DNShard) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_DNShard.Merge(m, src)
+}
+func (m *DNShard) XXX_Size() int {
+	return m.Size()
+}
+func (m *DNShard) XXX_DiscardUnknown() {
+	xxx_messageInfo_DNShard.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_DNShard proto.InternalMessageInfo
+
+func (m *DNShard) GetReplicaID() uint64 {
+	if m != nil {
+		return m.ReplicaID
+	}
+	return 0
+}
+
+func (m *DNShard) GetAddress() string {
 	if m != nil {
 		return m.Address
 	}
 	return ""
 }
 
+// LogShardRecord is Log Shard Metadata describing what is a Log shard. It is
+// internally used by the HAKeeper to maintain how many Log shards are available
+// in the system.
+type LogShardRecord struct {
+	// ShardID is the id of the Log Shard.
+	ShardID uint64 `protobuf:"varint,1,opt,name=ShardID,proto3" json:"ShardID,omitempty"`
+	// NumberOfReplicas is the number of replicas in the shard.
+	NumberOfReplicas uint64 `protobuf:"varint,2,opt,name=NumberOfReplicas,proto3" json:"NumberOfReplicas,omitempty"`
+	// Name is the human readable name of the shard given by the DN.
+	Name                 string   `protobuf:"bytes,3,opt,name=Name,proto3" json:"Name,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-"`
+	XXX_unrecognized     []byte   `json:"-"`
+	XXX_sizecache        int32    `json:"-"`
+}
+
+func (m *LogShardRecord) Reset()         { *m = LogShardRecord{} }
+func (m *LogShardRecord) String() string { return proto.CompactTextString(m) }
+func (*LogShardRecord) ProtoMessage()    {}
+func (*LogShardRecord) Descriptor() ([]byte, []int) {
+	return fileDescriptor_56d9f74966f40d04, []int{2}
+}
+func (m *LogShardRecord) XXX_Unmarshal(b []byte) error {
+	return m.Unmarshal(b)
+}
+func (m *LogShardRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	if deterministic {
+		return xxx_messageInfo_LogShardRecord.Marshal(b, m, deterministic)
+	} else {
+		b = b[:cap(b)]
+		n, err := m.MarshalToSizedBuffer(b)
+		if err != nil {
+			return nil, err
+		}
+		return b[:n], nil
+	}
+}
+func (m *LogShardRecord) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_LogShardRecord.Merge(m, src)
+}
+func (m *LogShardRecord) XXX_Size() int {
+	return m.Size()
+}
+func (m *LogShardRecord) XXX_DiscardUnknown() {
+	xxx_messageInfo_LogShardRecord.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_LogShardRecord proto.InternalMessageInfo
+
+func (m *LogShardRecord) GetShardID() uint64 {
+	if m != nil {
+		return m.ShardID
+	}
+	return 0
+}
+
+func (m *LogShardRecord) GetNumberOfReplicas() uint64 {
+	if m != nil {
+		return m.NumberOfReplicas
+	}
+	return 0
+}
+
+func (m *LogShardRecord) GetName() string {
+	if m != nil {
+		return m.Name
+	}
+	return ""
+}
+
 func init() {
-	proto.RegisterType((*DN)(nil), "metadata.DN")
+	proto.RegisterType((*DNShardRecord)(nil), "metadata.DNShardRecord")
+	proto.RegisterType((*DNShard)(nil), "metadata.DNShard")
+	proto.RegisterType((*LogShardRecord)(nil), "metadata.LogShardRecord")
 }
 
 func init() { proto.RegisterFile("metadata.proto", fileDescriptor_56d9f74966f40d04) }
 
 var fileDescriptor_56d9f74966f40d04 = []byte{
-	// 245 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0x41, 0x4a, 0xc4, 0x30,
-	0x14, 0x86, 0x79, 0x99, 0x99, 0xea, 0x3c, 0x44, 0x24, 0x88, 0x04, 0x91, 0x5a, 0x5c, 0x75, 0xe3,
-	0x04, 0xf1, 0x00, 0xc2, 0xd0, 0x4d, 0x37, 0x2e, 0xea, 0xce, 0xdd, 0xeb, 0x24, 0x66, 0x82, 0xd3,
-	0xa6, 0xa4, 0x19, 0xf0, 0x30, 0x1e, 0xc8, 0xa5, 0x27, 0x10, 0xe9, 0x49, 0x64, 0x32, 0x14, 0xbb,
-	0xfb, 0xbf, 0xef, 0x4f, 0x16, 0xff, 0xc3, 0xf3, 0x46, 0x07, 0x52, 0x14, 0x68, 0xd5, 0x79, 0x17,
-	0x1c, 0x3f, 0x1d, 0xf9, 0xfa, 0xde, 0xd8, 0xb0, 0xdd, 0xd7, 0xab, 0x8d, 0x6b, 0xa4, 0x71, 0xc6,
-	0xc9, 0xf8, 0xa0, 0xde, 0xbf, 0x45, 0x8a, 0x10, 0xd3, 0xf1, 0xe3, 0xdd, 0x27, 0x20, 0x2b, 0x9e,
-	0xf9, 0x15, 0x32, 0xab, 0x04, 0x64, 0x90, 0xcf, 0xd7, 0xc9, 0xf0, 0x73, 0xcb, 0xca, 0xa2, 0x62,
-	0x56, 0xf1, 0x1b, 0x5c, 0x7a, 0xdd, 0xed, 0xec, 0x86, 0xca, 0x42, 0xb0, 0x43, 0x5d, 0xfd, 0x0b,
-	0x9e, 0x22, 0xee, 0x9c, 0x79, 0xd9, 0x92, 0x57, 0x65, 0x21, 0x66, 0xb1, 0x9e, 0x18, 0x7e, 0x89,
-	0x8b, 0x3e, 0x90, 0x0f, 0x62, 0x9e, 0x41, 0x7e, 0x56, 0x1d, 0x81, 0x5f, 0xe0, 0x4c, 0xb7, 0x4a,
-	0x2c, 0xa2, 0x3b, 0x44, 0x2e, 0xf0, 0x84, 0x94, 0xf2, 0xba, 0xef, 0x45, 0x92, 0x41, 0xbe, 0xac,
-	0x46, 0x5c, 0x3f, 0x7d, 0x0d, 0x29, 0x7c, 0x0f, 0x29, 0xfc, 0x0e, 0x29, 0xbc, 0x3e, 0x4c, 0xb6,
-	0x35, 0x14, 0xbc, 0xfd, 0x70, 0xde, 0x1a, 0xdb, 0x8e, 0xd0, 0x6a, 0xd9, 0xbd, 0x1b, 0xd9, 0xd5,
-	0x72, 0x3c, 0x47, 0x9d, 0xc4, 0x99, 0x8f, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf4, 0xf5, 0x5c,
-	0xb9, 0x31, 0x01, 0x00, 0x00,
-}
-
-func (m *DN) Marshal() (dAtA []byte, err error) {
+	// 306 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xd1, 0x4a, 0xc3, 0x30,
+	0x14, 0x86, 0x8d, 0x9b, 0x6e, 0x3b, 0xea, 0x18, 0x41, 0xb0, 0x88, 0x74, 0x63, 0x57, 0x43, 0xb0,
+	0x45, 0x7d, 0x00, 0x71, 0x4c, 0x44, 0x90, 0x0a, 0xd9, 0x9d, 0x77, 0x69, 0x93, 0x65, 0x55, 0xdb,
+	0xd4, 0x34, 0x05, 0x9f, 0xc1, 0x27, 0xdb, 0xe5, 0x9e, 0x60, 0x48, 0x9f, 0x44, 0x96, 0x35, 0x73,
+	0xce, 0x0b, 0xef, 0xce, 0xf7, 0x9f, 0x36, 0xff, 0xf9, 0xcf, 0x81, 0x76, 0xc2, 0x35, 0x65, 0x54,
+	0x53, 0x2f, 0x53, 0x52, 0x4b, 0xdc, 0xb4, 0x7c, 0x7a, 0x21, 0x62, 0x3d, 0x2d, 0x42, 0x2f, 0x92,
+	0x89, 0x2f, 0xa4, 0x90, 0xbe, 0xf9, 0x20, 0x2c, 0x26, 0x86, 0x0c, 0x98, 0x6a, 0xf5, 0x63, 0xff,
+	0x1d, 0x8e, 0x46, 0xc1, 0x78, 0x4a, 0x15, 0x23, 0x3c, 0x92, 0x8a, 0x61, 0x07, 0x1a, 0x06, 0x1f,
+	0x46, 0x0e, 0xea, 0xa1, 0x41, 0x9d, 0x58, 0xc4, 0x2e, 0xc0, 0xa3, 0x14, 0xb6, 0xb9, 0x6b, 0x9a,
+	0x1b, 0x0a, 0x3e, 0x86, 0xbd, 0xb1, 0xa6, 0x4a, 0x3b, 0xb5, 0x1e, 0x1a, 0x1c, 0x92, 0x15, 0xe0,
+	0x0e, 0xd4, 0xee, 0x52, 0xe6, 0xd4, 0x8d, 0xb6, 0x2c, 0xfb, 0x9f, 0x08, 0x1a, 0x95, 0x27, 0xbe,
+	0xdf, 0xb2, 0x37, 0x9e, 0x07, 0x57, 0x27, 0xde, 0x3a, 0xdf, 0xaf, 0xf6, 0xb0, 0x39, 0x5b, 0x74,
+	0x77, 0xe6, 0x8b, 0x2e, 0x22, 0x5b, 0x63, 0x9f, 0x41, 0x8b, 0xf0, 0xec, 0x2d, 0x8e, 0xe8, 0x7a,
+	0xb6, 0x1f, 0x61, 0x19, 0xea, 0x96, 0x31, 0xc5, 0xf3, 0xdc, 0x0c, 0xd7, 0x22, 0x16, 0xfb, 0x2f,
+	0xd0, 0xb6, 0x11, 0xfe, 0x5d, 0xc0, 0x39, 0x74, 0x82, 0x22, 0x09, 0xb9, 0x7a, 0x9a, 0x54, 0x4f,
+	0xe7, 0x95, 0xd5, 0x1f, 0x1d, 0x63, 0xa8, 0x07, 0x34, 0xe1, 0x95, 0x9d, 0xa9, 0x87, 0x37, 0xb3,
+	0xd2, 0x45, 0xf3, 0xd2, 0x45, 0x5f, 0xa5, 0x8b, 0x9e, 0x2f, 0x37, 0x0e, 0x95, 0x50, 0xad, 0xe2,
+	0x0f, 0xa9, 0x62, 0x11, 0xa7, 0x16, 0x52, 0xee, 0x67, 0xaf, 0xc2, 0xcf, 0x42, 0xdf, 0xee, 0x22,
+	0xdc, 0x37, 0x37, 0xbb, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x44, 0xd1, 0x9e, 0x99, 0xfe, 0x01,
+	0x00, 0x00,
+}
+
+func (m *DNShardRecord) Marshal() (dAtA []byte, err error) {
 	size := m.Size()
 	dAtA = make([]byte, size)
 	n, err := m.MarshalToSizedBuffer(dAtA[:size])
@@ -155,12 +274,12 @@ func (m *DN) Marshal() (dAtA []byte, err error) {
 	return dAtA[:n], nil
 }
 
-func (m *DN) MarshalTo(dAtA []byte) (int, error) {
+func (m *DNShardRecord) MarshalTo(dAtA []byte) (int, error) {
 	size := m.Size()
 	return m.MarshalToSizedBuffer(dAtA[:size])
 }
 
-func (m *DN) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+func (m *DNShardRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) {
 	i := len(dAtA)
 	_ = i
 	var l int
@@ -169,39 +288,120 @@ func (m *DN) MarshalToSizedBuffer(dAtA []byte) (int, error) {
 		i -= len(m.XXX_unrecognized)
 		copy(dAtA[i:], m.XXX_unrecognized)
 	}
-	if len(m.Address) > 0 {
-		i -= len(m.Address)
-		copy(dAtA[i:], m.Address)
-		i = encodeVarintMetadata(dAtA, i, uint64(len(m.Address)))
-		i--
-		dAtA[i] = 0x32
-	}
 	if len(m.End) > 0 {
 		i -= len(m.End)
 		copy(dAtA[i:], m.End)
 		i = encodeVarintMetadata(dAtA, i, uint64(len(m.End)))
 		i--
-		dAtA[i] = 0x2a
+		dAtA[i] = 0x22
 	}
 	if len(m.Start) > 0 {
 		i -= len(m.Start)
 		copy(dAtA[i:], m.Start)
 		i = encodeVarintMetadata(dAtA, i, uint64(len(m.Start)))
 		i--
-		dAtA[i] = 0x22
+		dAtA[i] = 0x1a
 	}
 	if m.LogShardID != 0 {
 		i = encodeVarintMetadata(dAtA, i, uint64(m.LogShardID))
 		i--
-		dAtA[i] = 0x18
+		dAtA[i] = 0x10
+	}
+	if m.ShardID != 0 {
+		i = encodeVarintMetadata(dAtA, i, uint64(m.ShardID))
+		i--
+		dAtA[i] = 0x8
+	}
+	return len(dAtA) - i, nil
+}
+
+func (m *DNShard) Marshal() (dAtA []byte, err error) {
+	size := m.Size()
+	dAtA = make([]byte, size)
+	n, err := m.MarshalToSizedBuffer(dAtA[:size])
+	if err != nil {
+		return nil, err
+	}
+	return dAtA[:n], nil
+}
+
+func (m *DNShard) MarshalTo(dAtA []byte) (int, error) {
+	size := m.Size()
+	return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *DNShard) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+	i := len(dAtA)
+	_ = i
+	var l int
+	_ = l
+	if m.XXX_unrecognized != nil {
+		i -= len(m.XXX_unrecognized)
+		copy(dAtA[i:], m.XXX_unrecognized)
+	}
+	if len(m.Address) > 0 {
+		i -= len(m.Address)
+		copy(dAtA[i:], m.Address)
+		i = encodeVarintMetadata(dAtA, i, uint64(len(m.Address)))
+		i--
+		dAtA[i] = 0x1a
 	}
 	if m.ReplicaID != 0 {
 		i = encodeVarintMetadata(dAtA, i, uint64(m.ReplicaID))
 		i--
 		dAtA[i] = 0x10
 	}
-	if m.ID != 0 {
-		i = encodeVarintMetadata(dAtA, i, uint64(m.ID))
+	{
+		size, err := m.DNShardRecord.MarshalToSizedBuffer(dAtA[:i])
+		if err != nil {
+			return 0, err
+		}
+		i -= size
+		i = encodeVarintMetadata(dAtA, i, uint64(size))
+	}
+	i--
+	dAtA[i] = 0xa
+	return len(dAtA) - i, nil
+}
+
+func (m *LogShardRecord) Marshal() (dAtA []byte, err error) {
+	size := m.Size()
+	dAtA = make([]byte, size)
+	n, err := m.MarshalToSizedBuffer(dAtA[:size])
+	if err != nil {
+		return nil, err
+	}
+	return dAtA[:n], nil
+}
+
+func (m *LogShardRecord) MarshalTo(dAtA []byte) (int, error) {
+	size := m.Size()
+	return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *LogShardRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+	i := len(dAtA)
+	_ = i
+	var l int
+	_ = l
+	if m.XXX_unrecognized != nil {
+		i -= len(m.XXX_unrecognized)
+		copy(dAtA[i:], m.XXX_unrecognized)
+	}
+	if len(m.Name) > 0 {
+		i -= len(m.Name)
+		copy(dAtA[i:], m.Name)
+		i = encodeVarintMetadata(dAtA, i, uint64(len(m.Name)))
+		i--
+		dAtA[i] = 0x1a
+	}
+	if m.NumberOfReplicas != 0 {
+		i = encodeVarintMetadata(dAtA, i, uint64(m.NumberOfReplicas))
+		i--
+		dAtA[i] = 0x10
+	}
+	if m.ShardID != 0 {
+		i = encodeVarintMetadata(dAtA, i, uint64(m.ShardID))
 		i--
 		dAtA[i] = 0x8
 	}
@@ -219,17 +419,14 @@ func encodeVarintMetadata(dAtA []byte, offset int, v uint64) int {
 	dAtA[offset] = uint8(v)
 	return base
 }
-func (m *DN) Size() (n int) {
+func (m *DNShardRecord) Size() (n int) {
 	if m == nil {
 		return 0
 	}
 	var l int
 	_ = l
-	if m.ID != 0 {
-		n += 1 + sovMetadata(uint64(m.ID))
-	}
-	if m.ReplicaID != 0 {
-		n += 1 + sovMetadata(uint64(m.ReplicaID))
+	if m.ShardID != 0 {
+		n += 1 + sovMetadata(uint64(m.ShardID))
 	}
 	if m.LogShardID != 0 {
 		n += 1 + sovMetadata(uint64(m.LogShardID))
@@ -242,6 +439,23 @@ func (m *DN) Size() (n int) {
 	if l > 0 {
 		n += 1 + l + sovMetadata(uint64(l))
 	}
+	if m.XXX_unrecognized != nil {
+		n += len(m.XXX_unrecognized)
+	}
+	return n
+}
+
+func (m *DNShard) Size() (n int) {
+	if m == nil {
+		return 0
+	}
+	var l int
+	_ = l
+	l = m.DNShardRecord.Size()
+	n += 1 + l + sovMetadata(uint64(l))
+	if m.ReplicaID != 0 {
+		n += 1 + sovMetadata(uint64(m.ReplicaID))
+	}
 	l = len(m.Address)
 	if l > 0 {
 		n += 1 + l + sovMetadata(uint64(l))
@@ -252,13 +466,35 @@ func (m *DN) Size() (n int) {
 	return n
 }
 
+func (m *LogShardRecord) Size() (n int) {
+	if m == nil {
+		return 0
+	}
+	var l int
+	_ = l
+	if m.ShardID != 0 {
+		n += 1 + sovMetadata(uint64(m.ShardID))
+	}
+	if m.NumberOfReplicas != 0 {
+		n += 1 + sovMetadata(uint64(m.NumberOfReplicas))
+	}
+	l = len(m.Name)
+	if l > 0 {
+		n += 1 + l + sovMetadata(uint64(l))
+	}
+	if m.XXX_unrecognized != nil {
+		n += len(m.XXX_unrecognized)
+	}
+	return n
+}
+
 func sovMetadata(x uint64) (n int) {
 	return (math_bits.Len64(x|1) + 6) / 7
 }
 func sozMetadata(x uint64) (n int) {
 	return sovMetadata(uint64((x << 1) ^ uint64((int64(x) >> 63))))
 }
-func (m *DN) Unmarshal(dAtA []byte) error {
+func (m *DNShardRecord) Unmarshal(dAtA []byte) error {
 	l := len(dAtA)
 	iNdEx := 0
 	for iNdEx < l {
@@ -281,17 +517,17 @@ func (m *DN) Unmarshal(dAtA []byte) error {
 		fieldNum := int32(wire >> 3)
 		wireType := int(wire & 0x7)
 		if wireType == 4 {
-			return fmt.Errorf("proto: DN: wiretype end group for non-group")
+			return fmt.Errorf("proto: DNShardRecord: wiretype end group for non-group")
 		}
 		if fieldNum <= 0 {
-			return fmt.Errorf("proto: DN: illegal tag %d (wire type %d)", fieldNum, wire)
+			return fmt.Errorf("proto: DNShardRecord: illegal tag %d (wire type %d)", fieldNum, wire)
 		}
 		switch fieldNum {
 		case 1:
 			if wireType != 0 {
-				return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
+				return fmt.Errorf("proto: wrong wireType = %d for field ShardID", wireType)
 			}
-			m.ID = 0
+			m.ShardID = 0
 			for shift := uint(0); ; shift += 7 {
 				if shift >= 64 {
 					return ErrIntOverflowMetadata
@@ -301,16 +537,16 @@ func (m *DN) Unmarshal(dAtA []byte) error {
 				}
 				b := dAtA[iNdEx]
 				iNdEx++
-				m.ID |= uint64(b&0x7F) << shift
+				m.ShardID |= uint64(b&0x7F) << shift
 				if b < 0x80 {
 					break
 				}
 			}
 		case 2:
 			if wireType != 0 {
-				return fmt.Errorf("proto: wrong wireType = %d for field ReplicaID", wireType)
+				return fmt.Errorf("proto: wrong wireType = %d for field LogShardID", wireType)
 			}
-			m.ReplicaID = 0
+			m.LogShardID = 0
 			for shift := uint(0); ; shift += 7 {
 				if shift >= 64 {
 					return ErrIntOverflowMetadata
@@ -320,16 +556,16 @@ func (m *DN) Unmarshal(dAtA []byte) error {
 				}
 				b := dAtA[iNdEx]
 				iNdEx++
-				m.ReplicaID |= uint64(b&0x7F) << shift
+				m.LogShardID |= uint64(b&0x7F) << shift
 				if b < 0x80 {
 					break
 				}
 			}
 		case 3:
-			if wireType != 0 {
-				return fmt.Errorf("proto: wrong wireType = %d for field LogShardID", wireType)
+			if wireType != 2 {
+				return fmt.Errorf("proto: wrong wireType = %d for field Start", wireType)
 			}
-			m.LogShardID = 0
+			var byteLen int
 			for shift := uint(0); ; shift += 7 {
 				if shift >= 64 {
 					return ErrIntOverflowMetadata
@@ -339,14 +575,29 @@ func (m *DN) Unmarshal(dAtA []byte) error {
 				}
 				b := dAtA[iNdEx]
 				iNdEx++
-				m.LogShardID |= uint64(b&0x7F) << shift
+				byteLen |= int(b&0x7F) << shift
 				if b < 0x80 {
 					break
 				}
 			}
+			if byteLen < 0 {
+				return ErrInvalidLengthMetadata
+			}
+			postIndex := iNdEx + byteLen
+			if postIndex < 0 {
+				return ErrInvalidLengthMetadata
+			}
+			if postIndex > l {
+				return io.ErrUnexpectedEOF
+			}
+			m.Start = append(m.Start[:0], dAtA[iNdEx:postIndex]...)
+			if m.Start == nil {
+				m.Start = []byte{}
+			}
+			iNdEx = postIndex
 		case 4:
 			if wireType != 2 {
-				return fmt.Errorf("proto: wrong wireType = %d for field Start", wireType)
+				return fmt.Errorf("proto: wrong wireType = %d for field End", wireType)
 			}
 			var byteLen int
 			for shift := uint(0); ; shift += 7 {
@@ -373,16 +624,67 @@ func (m *DN) Unmarshal(dAtA []byte) error {
 			if postIndex > l {
 				return io.ErrUnexpectedEOF
 			}
-			m.Start = append(m.Start[:0], dAtA[iNdEx:postIndex]...)
-			if m.Start == nil {
-				m.Start = []byte{}
+			m.End = append(m.End[:0], dAtA[iNdEx:postIndex]...)
+			if m.End == nil {
+				m.End = []byte{}
 			}
 			iNdEx = postIndex
-		case 5:
+		default:
+			iNdEx = preIndex
+			skippy, err := skipMetadata(dAtA[iNdEx:])
+			if err != nil {
+				return err
+			}
+			if (skippy < 0) || (iNdEx+skippy) < 0 {
+				return ErrInvalidLengthMetadata
+			}
+			if (iNdEx + skippy) > l {
+				return io.ErrUnexpectedEOF
+			}
+			m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
+			iNdEx += skippy
+		}
+	}
+
+	if iNdEx > l {
+		return io.ErrUnexpectedEOF
+	}
+	return nil
+}
+func (m *DNShard) Unmarshal(dAtA []byte) error {
+	l := len(dAtA)
+	iNdEx := 0
+	for iNdEx < l {
+		preIndex := iNdEx
+		var wire uint64
+		for shift := uint(0); ; shift += 7 {
+			if shift >= 64 {
+				return ErrIntOverflowMetadata
+			}
+			if iNdEx >= l {
+				return io.ErrUnexpectedEOF
+			}
+			b := dAtA[iNdEx]
+			iNdEx++
+			wire |= uint64(b&0x7F) << shift
+			if b < 0x80 {
+				break
+			}
+		}
+		fieldNum := int32(wire >> 3)
+		wireType := int(wire & 0x7)
+		if wireType == 4 {
+			return fmt.Errorf("proto: DNShard: wiretype end group for non-group")
+		}
+		if fieldNum <= 0 {
+			return fmt.Errorf("proto: DNShard: illegal tag %d (wire type %d)", fieldNum, wire)
+		}
+		switch fieldNum {
+		case 1:
 			if wireType != 2 {
-				return fmt.Errorf("proto: wrong wireType = %d for field End", wireType)
+				return fmt.Errorf("proto: wrong wireType = %d for field DNShardRecord", wireType)
 			}
-			var byteLen int
+			var msglen int
 			for shift := uint(0); ; shift += 7 {
 				if shift >= 64 {
 					return ErrIntOverflowMetadata
@@ -392,27 +694,45 @@ func (m *DN) Unmarshal(dAtA []byte) error {
 				}
 				b := dAtA[iNdEx]
 				iNdEx++
-				byteLen |= int(b&0x7F) << shift
+				msglen |= int(b&0x7F) << shift
 				if b < 0x80 {
 					break
 				}
 			}
-			if byteLen < 0 {
+			if msglen < 0 {
 				return ErrInvalidLengthMetadata
 			}
-			postIndex := iNdEx + byteLen
+			postIndex := iNdEx + msglen
 			if postIndex < 0 {
 				return ErrInvalidLengthMetadata
 			}
 			if postIndex > l {
 				return io.ErrUnexpectedEOF
 			}
-			m.End = append(m.End[:0], dAtA[iNdEx:postIndex]...)
-			if m.End == nil {
-				m.End = []byte{}
+			if err := m.DNShardRecord.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+				return err
 			}
 			iNdEx = postIndex
-		case 6:
+		case 2:
+			if wireType != 0 {
+				return fmt.Errorf("proto: wrong wireType = %d for field ReplicaID", wireType)
+			}
+			m.ReplicaID = 0
+			for shift := uint(0); ; shift += 7 {
+				if shift >= 64 {
+					return ErrIntOverflowMetadata
+				}
+				if iNdEx >= l {
+					return io.ErrUnexpectedEOF
+				}
+				b := dAtA[iNdEx]
+				iNdEx++
+				m.ReplicaID |= uint64(b&0x7F) << shift
+				if b < 0x80 {
+					break
+				}
+			}
+		case 3:
 			if wireType != 2 {
 				return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
 			}
@@ -466,6 +786,127 @@ func (m *DN) Unmarshal(dAtA []byte) error {
 	}
 	return nil
 }
+func (m *LogShardRecord) Unmarshal(dAtA []byte) error {
+	l := len(dAtA)
+	iNdEx := 0
+	for iNdEx < l {
+		preIndex := iNdEx
+		var wire uint64
+		for shift := uint(0); ; shift += 7 {
+			if shift >= 64 {
+				return ErrIntOverflowMetadata
+			}
+			if iNdEx >= l {
+				return io.ErrUnexpectedEOF
+			}
+			b := dAtA[iNdEx]
+			iNdEx++
+			wire |= uint64(b&0x7F) << shift
+			if b < 0x80 {
+				break
+			}
+		}
+		fieldNum := int32(wire >> 3)
+		wireType := int(wire & 0x7)
+		if wireType == 4 {
+			return fmt.Errorf("proto: LogShardRecord: wiretype end group for non-group")
+		}
+		if fieldNum <= 0 {
+			return fmt.Errorf("proto: LogShardRecord: illegal tag %d (wire type %d)", fieldNum, wire)
+		}
+		switch fieldNum {
+		case 1:
+			if wireType != 0 {
+				return fmt.Errorf("proto: wrong wireType = %d for field ShardID", wireType)
+			}
+			m.ShardID = 0
+			for shift := uint(0); ; shift += 7 {
+				if shift >= 64 {
+					return ErrIntOverflowMetadata
+				}
+				if iNdEx >= l {
+					return io.ErrUnexpectedEOF
+				}
+				b := dAtA[iNdEx]
+				iNdEx++
+				m.ShardID |= uint64(b&0x7F) << shift
+				if b < 0x80 {
+					break
+				}
+			}
+		case 2:
+			if wireType != 0 {
+				return fmt.Errorf("proto: wrong wireType = %d for field NumberOfReplicas", wireType)
+			}
+			m.NumberOfReplicas = 0
+			for shift := uint(0); ; shift += 7 {
+				if shift >= 64 {
+					return ErrIntOverflowMetadata
+				}
+				if iNdEx >= l {
+					return io.ErrUnexpectedEOF
+				}
+				b := dAtA[iNdEx]
+				iNdEx++
+				m.NumberOfReplicas |= uint64(b&0x7F) << shift
+				if b < 0x80 {
+					break
+				}
+			}
+		case 3:
+			if wireType != 2 {
+				return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
+			}
+			var stringLen uint64
+			for shift := uint(0); ; shift += 7 {
+				if shift >= 64 {
+					return ErrIntOverflowMetadata
+				}
+				if iNdEx >= l {
+					return io.ErrUnexpectedEOF
+				}
+				b := dAtA[iNdEx]
+				iNdEx++
+				stringLen |= uint64(b&0x7F) << shift
+				if b < 0x80 {
+					break
+				}
+			}
+			intStringLen := int(stringLen)
+			if intStringLen < 0 {
+				return ErrInvalidLengthMetadata
+			}
+			postIndex := iNdEx + intStringLen
+			if postIndex < 0 {
+				return ErrInvalidLengthMetadata
+			}
+			if postIndex > l {
+				return io.ErrUnexpectedEOF
+			}
+			m.Name = string(dAtA[iNdEx:postIndex])
+			iNdEx = postIndex
+		default:
+			iNdEx = preIndex
+			skippy, err := skipMetadata(dAtA[iNdEx:])
+			if err != nil {
+				return err
+			}
+			if (skippy < 0) || (iNdEx+skippy) < 0 {
+				return ErrInvalidLengthMetadata
+			}
+			if (iNdEx + skippy) > l {
+				return io.ErrUnexpectedEOF
+			}
+			m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
+			iNdEx += skippy
+		}
+	}
+
+	if iNdEx > l {
+		return io.ErrUnexpectedEOF
+	}
+	return nil
+}
 func skipMetadata(dAtA []byte) (n int, err error) {
 	l := len(dAtA)
 	iNdEx := 0
diff --git a/pkg/pb/plan/plan.pb.go b/pkg/pb/plan/plan.pb.go
index ab1723d87..4fa59cab7 100644
--- a/pkg/pb/plan/plan.pb.go
+++ b/pkg/pb/plan/plan.pb.go
@@ -6785,8 +6785,6 @@ func (m *Node) MarshalToSizedBuffer(dAtA []byte) (int, error) {
 			i--
 			dAtA[i] = 0x5a
 		}
-		i--
-		dAtA[i] = 0x6a
 	}
 	if len(m.GroupingSet) > 0 {
 		for iNdEx := len(m.GroupingSet) - 1; iNdEx >= 0; iNdEx-- {
diff --git a/pkg/sql/colexec/extend/overload/cast.template b/pkg/sql/colexec/extend/overload/cast.template
index 3c94a988f..d1e897912 100644
--- a/pkg/sql/colexec/extend/overload/cast.template
+++ b/pkg/sql/colexec/extend/overload/cast.template
@@ -292,7 +292,7 @@ func initCast() {
 						continue
 					}
 					varcharValue := vs.Get(int64(i))
-					data, err2 := types.ParseDatetime(string(varcharValue))
+					data, err2 := types.ParseDatetime(string(varcharValue), 6) // default datetime precision is 6
 					if err2 != nil {
 						return nil, err2
 					}
diff --git a/pkg/sql/colexec2/aggregate/aggregate.go b/pkg/sql/colexec2/aggregate/aggregate.go
index ff4acdcfa..01abc5875 100755
--- a/pkg/sql/colexec2/aggregate/aggregate.go
+++ b/pkg/sql/colexec2/aggregate/aggregate.go
@@ -36,21 +36,26 @@ import (
 )
 
 var sumReturnTypes = map[types.T]types.T{
-	types.T_int8:    types.T_int64,
-	types.T_int16:   types.T_int64,
-	types.T_int32:   types.T_int64,
-	types.T_int64:   types.T_int64,
-	types.T_uint8:   types.T_uint64,
-	types.T_uint16:  types.T_uint64,
-	types.T_uint32:  types.T_uint64,
-	types.T_uint64:  types.T_uint64,
-	types.T_float32: types.T_float64,
-	types.T_float64: types.T_float64,
+	types.T_int8:       types.T_int64,
+	types.T_int16:      types.T_int64,
+	types.T_int32:      types.T_int64,
+	types.T_int64:      types.T_int64,
+	types.T_uint8:      types.T_uint64,
+	types.T_uint16:     types.T_uint64,
+	types.T_uint32:     types.T_uint64,
+	types.T_uint64:     types.T_uint64,
+	types.T_float32:    types.T_float64,
+	types.T_float64:    types.T_float64,
+	types.T_decimal64:  types.T_decimal64,
+	types.T_decimal128: types.T_decimal128,
 }
 
 func ReturnType(op int, typ types.T) types.T {
 	switch op {
 	case Avg:
+		if typ == types.T_decimal64 || typ == types.T_decimal128 {
+			return types.T_decimal128
+		}
 		return types.T_float64
 	case Max:
 		return typ
@@ -146,6 +151,10 @@ func NewSum(typ types.Type) (ring.Ring, error) {
 		return sum.NewInt(typ), nil
 	case types.T_uint8, types.T_uint16, types.T_uint32, types.T_uint64:
 		return sum.NewUint(typ), nil
+	case types.T_decimal64:
+		return sum.NewDecimal64(typ), nil
+	case types.T_decimal128:
+		return sum.NewDecimal128(typ), nil
 	}
 	return nil, fmt.Errorf("'%v' not support Sum", typ)
 }
@@ -180,6 +189,10 @@ func NewMax(typ types.Type) (ring.Ring, error) {
 		return max.NewDate(typ), nil
 	case types.T_datetime:
 		return max.NewDatetime(typ), nil
+	case types.T_decimal64:
+		return max.NewDecimal64(typ), nil
+	case types.T_decimal128:
+		return max.NewDecimal128(typ), nil
 	}
 	return nil, fmt.Errorf("'%v' not support Max", typ)
 }
@@ -214,6 +227,10 @@ func NewMin(typ types.Type) (ring.Ring, error) {
 		return min.NewDate(typ), nil
 	case types.T_datetime:
 		return min.NewDatetime(typ), nil
+	case types.T_decimal64:
+		return min.NewDecimal64(typ), nil
+	case types.T_decimal128:
+		return min.NewDecimal128(typ), nil
 	}
 	return nil, fmt.Errorf("'%v' not support Min", typ)
 }
diff --git a/pkg/sql/parsers/dialect/mysql/mysql_sql.go b/pkg/sql/parsers/dialect/mysql/mysql_sql.go
index 4534dae61..014f1ab95 100644
--- a/pkg/sql/parsers/dialect/mysql/mysql_sql.go
+++ b/pkg/sql/parsers/dialect/mysql/mysql_sql.go
@@ -914,7 +914,7 @@ const yyEofCode = 1
 const yyErrCode = 2
 const yyInitialStackSize = 16
 
-//line mysql_sql.y:6495
+//line mysql_sql.y:6500
 
 //line yacctab:1
 var yyExca = [...]int{
@@ -1080,209 +1080,209 @@ var yyAct = [...]int{
 	559, 1982, 1738, 1956, 84, 524, 1613, 292, 1148, 840,
 	1911, 1813, 557, 1814, 1805, 303, 87, 1967, 1507, 462,
 	84, 305, 1884, 1771, 393, 1680, 296, 19, 1397, 337,
-	337, 1697, 1804, 1503, 763, 512, 1700, 583, 1709, 83,
-	823, 593, 1540, 1491, 1705, 1373, 663, 52, 1519, 1512,
-	1666, 1531, 1508, 394, 1154, 1558, 1547, 1557, 1442, 415,
-	718, 942, 634, 84, 528, 298, 847, 567, 957, 960,
-	1223, 952, 951, 52, 1404, 760, 943, 1293, 1210, 1307,
-	3, 51, 1237, 312, 312, 295, 12, 293, 6, 294,
-	5, 816, 1367, 1746, 644, 1162, 779, 1224, 428, 1221,
-	761, 343, 586, 342, 500, 735, 820, 19, 285, 307,
-	288, 842, 792, 791, 793, 1121, 439, 464, 849, 879,
-	385, 404, 406, 752, 414, 568, 309, 52, 450, 308,
-	1137, 80, 1829, 1734, 1612, 1130, 549, 479, 774, 945,
-	79, 412, 533, 585, 1349, 535, 79, 1492, 1368, 2020,
-	299, 510, 1133, 2031, 1356, 79, 810, 405, 531, 339,
-	344, 425, 79, 499, 715, 77, 12, 712, 6, 79,
-	5, 23, 39, 24, 362, 400, 355, 402, 410, 409,
-	2053, 79, 1468, 23, 39, 24, 805, 806, 714, 1359,
-	2051, 372, 536, 523, 75, 490, 522, 525, 526, 525,
-	526, 2069, 2070, 75, 795, 769, 494, 2088, 408, 1909,
-	75, 1912, 1913, 1914, 1915, 1495, 1991, 75, 1496, 1994,
-	1497, 1832, 1614, 773, 386, 1336, 442, 433, 1541, 75,
-	1520, 1521, 1522, 1523, 401, 1376, 1374, 1371, 1375, 1377,
-	485, 1370, 1369, 1544, 373, 1376, 1374, 817, 1375, 1377,
-	1135, 1883, 1133, 1791, 1790, 481, 1787, 492, 493, 1731,
-	491, 480, 1900, 1609, 1692, 84, 432, 1691, 486, 2079,
-	753, 2055, 1688, 1890, 2158, 431, 2174, 2093, 84, 2050,
-	1543, 1968, 1969, 1970, 1972, 1971, 2005, 357, 2100, 2030,
-	1213, 1214, 1215, 1981, 2149, 2028, 755, 354, 353, 1878,
-	2068, 1211, 1847, 1846, 466, 2011, 341, 2175, 407, 1379,
-	1380, 1381, 1382, 446, 2001, 2002, 545, 2005, 349, 488,
-	467, 2057, 2058, 2169, 79, 2140, 23, 39, 24, 1835,
-	1410, 1214, 1215, 521, 520, 1524, 52, 52, 406, 1357,
-	532, 442, 427, 1443, 65, 513, 483, 534, 72, 489,
-	430, 472, 1989, 2033, 2034, 1353, 1689, 1184, 484, 487,
-	411, 1141, 337, 781, 1610, 511, 476, 40, 482, 394,
-	394, 394, 75, 405, 444, 443, 754, 397, 515, 297,
-	1516, 1869, 1707, 1706, 1395, 514, 471, 516, 1182, 1181,
-	808, 505, 1180, 539, 415, 537, 538, 589, 589, 809,
-	435, 436, 1179, 807, 374, 397, 562, 375, 352, 2153,
-	717, 2117, 1498, 1407, 1347, 1346, 312, 1385, 348, 1941,
-	1335, 831, 468, 469, 470, 560, 732, 1329, 432, 84,
-	84, 84, 84, 1174, 369, 1146, 1115, 736, 68, 69,
-	749, 70, 71, 860, 720, 1841, 564, 1873, 570, 895,
-	445, 399, 429, 713, 1387, 1484, 337, 337, 432, 337,
-	529, 2056, 2135, 1980, 466, 2126, 1532, 767, 2015, 502,
-	356, 517, 1331, 52, 548, 525, 526, 337, 337, 399,
-	467, 561, 1387, 750, 52, 525, 526, 588, 588, 444,
-	443, 544, 1517, 337, 1212, 337, 2032, 787, 84, 57,
-	67, 76, 496, 38, 1492, 571, 573, 402, 572, 437,
-	504, 312, 800, 768, 337, 818, 786, 1690, 1687, 66,
-	64, 63, 1156, 1486, 552, 1136, 337, 394, 556, 337,
-	518, 1386, 478, 788, 1409, 1350, 798, 1186, 527, 1119,
-	530, 78, 727, 728, 547, 832, 782, 78, 723, 312,
-	576, 577, 578, 579, 580, 582, 78, 337, 337, 839,
-	84, 710, 415, 78, 401, 848, 1132, 569, 801, 857,
-	78, 434, 771, 1485, 776, 1376, 1374, 780, 1375, 1377,
-	312, 843, 78, 366, 1591, 789, 790, 748, 783, 796,
-	1871, 367, 797, 1308, 1870, 841, 377, 844, 772, 737,
-	738, 739, 740, 765, 756, 1513, 1516, 775, 2131, 802,
-	1724, 48, 312, 553, 554, 555, 1131, 49, 519, 770,
-	824, 912, 550, 824, 785, 1365, 731, 824, 1942, 1944,
-	1945, 1946, 1943, 551, 730, 1226, 1225, 794, 784, 834,
-	1874, 1875, 1300, 923, 854, 379, 378, 1723, 1308, 819,
-	1448, 1880, 837, 1879, 50, 814, 1298, 1299, 1297, 826,
-	1670, 861, 1580, 830, 855, 856, 854, 815, 1864, 855,
-	856, 854, 833, 468, 469, 470, 1682, 835, 898, 899,
-	900, 901, 902, 895, 1665, 910, 2164, 838, 1417, 1234,
-	827, 828, 829, 856, 854, 949, 949, 954, 1236, 836,
-	2145, 73, 913, 914, 915, 916, 845, 2132, 376, 911,
-	418, 423, 424, 2110, 848, 2094, 1952, 919, 1517, 2040,
-	405, 962, 1231, 1510, 1987, 78, 1986, 1511, 1514, 855,
-	856, 854, 1683, 1958, 855, 856, 854, 963, 938, 563,
-	917, 887, 1593, 855, 856, 854, 364, 1936, 365, 372,
-	2062, 2148, 1951, 363, 361, 360, 368, 1451, 370, 371,
-	1450, 406, 84, 84, 1149, 1150, 1935, 468, 469, 470,
-	560, 52, 855, 856, 854, 292, 403, 1950, 1948, 1515,
-	380, 1934, 1176, 855, 856, 854, 948, 1129, 931, 1938,
-	956, 337, 2147, 843, 1931, 1117, 405, 1151, 1153, 1925,
-	1116, 1922, 322, 1921, 321, 325, 317, 1887, 1830, 844,
-	1823, 1822, 337, 1949, 1947, 1454, 313, 855, 856, 854,
-	955, 1821, 402, 2129, 2130, 1937, 561, 332, 1820, 941,
-	1985, 589, 1817, 84, 1676, 1113, 1675, 1674, 961, 1206,
-	1673, 1208, 1114, 1480, 1312, 312, 721, 1739, 2089, 1165,
-	1166, 1167, 855, 856, 854, 1126, 1168, 1177, 2078, 2061,
-	1232, 1233, 1957, 1430, 2037, 2022, 1191, 2009, 420, 421,
-	422, 903, 904, 896, 897, 898, 899, 900, 901, 902,
-	895, 1163, 855, 856, 854, 938, 1281, 1282, 1283, 1284,
+	337, 1697, 1804, 1800, 763, 512, 1700, 583, 1709, 83,
+	1503, 593, 823, 1491, 1705, 1540, 663, 52, 1373, 1519,
+	1512, 1531, 1666, 394, 1558, 1508, 1154, 1547, 1557, 415,
+	718, 942, 634, 84, 1442, 298, 528, 847, 567, 957,
+	1223, 960, 951, 52, 943, 1307, 1404, 1293, 1210, 644,
+	3, 952, 1237, 312, 312, 760, 295, 12, 293, 6,
+	294, 5, 1746, 816, 1367, 1162, 779, 1224, 428, 343,
+	51, 761, 586, 342, 1221, 735, 500, 19, 793, 307,
+	791, 1130, 792, 285, 1121, 464, 842, 288, 439, 820,
+	879, 404, 406, 849, 414, 568, 385, 52, 309, 752,
+	1137, 308, 450, 80, 299, 479, 549, 1829, 1734, 1612,
+	774, 945, 533, 585, 1133, 535, 79, 2031, 23, 39,
+	24, 1349, 412, 1492, 1368, 79, 2020, 531, 510, 339,
+	1356, 425, 810, 79, 499, 77, 65, 12, 344, 6,
+	72, 5, 79, 400, 79, 362, 405, 402, 79, 2053,
+	23, 39, 24, 805, 806, 355, 1359, 715, 372, 40,
+	712, 795, 536, 79, 75, 23, 39, 24, 769, 1468,
+	410, 409, 523, 75, 2051, 522, 525, 526, 525, 526,
+	494, 714, 386, 2069, 2070, 1912, 1913, 1914, 1915, 490,
+	75, 2088, 75, 1909, 1495, 1991, 75, 1496, 1994, 1497,
+	408, 1832, 1614, 773, 1336, 442, 1520, 1521, 1522, 1523,
+	433, 75, 401, 1376, 1374, 1371, 1375, 1377, 1541, 1370,
+	1369, 817, 1376, 1374, 1544, 1375, 1377, 1135, 373, 1883,
+	68, 69, 1133, 70, 71, 84, 432, 1791, 1790, 481,
+	480, 485, 1787, 1731, 491, 431, 1609, 1524, 84, 492,
+	493, 1900, 753, 2030, 1692, 1688, 2079, 1691, 2174, 1890,
+	1213, 1214, 1215, 2158, 2093, 2055, 357, 2050, 2005, 486,
+	1543, 1211, 1981, 2100, 466, 2028, 354, 353, 755, 1878,
+	2149, 1847, 2068, 446, 1968, 1969, 1970, 1972, 1971, 1846,
+	467, 57, 67, 76, 341, 38, 2011, 349, 2001, 2002,
+	407, 2005, 369, 2057, 2058, 1559, 52, 52, 406, 532,
+	545, 66, 64, 63, 488, 1357, 2175, 2033, 2034, 2169,
+	430, 472, 2140, 442, 1379, 1380, 1381, 1382, 1570, 1567,
+	1568, 1569, 337, 1835, 1564, 427, 1563, 1562, 1560, 394,
+	394, 394, 511, 489, 521, 520, 1689, 483, 1443, 513,
+	1353, 534, 411, 444, 443, 514, 1989, 516, 754, 484,
+	487, 505, 405, 1184, 415, 1141, 781, 589, 589, 482,
+	1410, 1214, 1215, 1516, 1941, 471, 562, 435, 436, 1869,
+	717, 515, 476, 1610, 1873, 297, 312, 352, 1707, 1706,
+	1182, 1181, 1395, 1561, 1180, 539, 732, 348, 432, 84,
+	84, 84, 84, 48, 537, 538, 808, 736, 809, 49,
+	749, 1179, 807, 374, 2131, 375, 2153, 2117, 570, 831,
+	1498, 1407, 1347, 713, 1346, 1335, 337, 337, 432, 337,
+	1329, 1174, 1146, 1115, 466, 860, 720, 767, 564, 502,
+	445, 517, 1980, 52, 525, 526, 50, 337, 337, 356,
+	467, 366, 429, 750, 52, 2056, 895, 588, 588, 367,
+	2032, 544, 529, 337, 1212, 337, 1492, 787, 84, 525,
+	526, 444, 443, 571, 573, 1484, 437, 402, 572, 2135,
+	504, 312, 800, 768, 337, 1517, 786, 1376, 1374, 818,
+	1375, 1377, 2126, 548, 552, 1136, 337, 394, 556, 337,
+	478, 1687, 1156, 788, 1565, 1566, 798, 1690, 1532, 527,
+	2015, 530, 1350, 2132, 518, 832, 782, 78, 496, 312,
+	576, 577, 578, 579, 580, 723, 78, 337, 337, 839,
+	84, 710, 415, 1331, 78, 848, 582, 569, 801, 857,
+	1186, 1119, 401, 78, 776, 78, 1486, 780, 434, 78,
+	312, 843, 771, 737, 738, 739, 740, 789, 790, 796,
+	397, 748, 797, 547, 78, 841, 1591, 844, 783, 772,
+	854, 553, 554, 555, 1409, 765, 756, 1874, 1875, 775,
+	1513, 1516, 312, 1942, 1944, 1945, 1946, 1943, 1871, 802,
+	824, 912, 1870, 824, 785, 770, 1485, 824, 727, 728,
+	1385, 550, 519, 377, 1132, 1226, 1225, 794, 1880, 1308,
+	834, 397, 551, 923, 364, 1365, 365, 372, 856, 854,
+	819, 363, 361, 360, 368, 814, 370, 371, 1879, 2129,
+	2130, 861, 837, 1308, 399, 1448, 784, 1387, 418, 423,
+	424, 1670, 826, 815, 833, 1665, 830, 1864, 2148, 835,
+	1952, 1841, 379, 378, 1131, 910, 2164, 838, 1950, 2145,
+	827, 828, 829, 2110, 73, 949, 949, 954, 376, 836,
+	2146, 1234, 913, 914, 915, 916, 845, 1948, 1451, 911,
+	1236, 1450, 731, 1739, 848, 399, 1951, 919, 1387, 2147,
+	730, 962, 1231, 1517, 1949, 917, 2094, 2040, 1510, 563,
+	1987, 1986, 1511, 1514, 855, 856, 854, 963, 938, 405,
+	1958, 1938, 887, 1947, 1386, 894, 893, 903, 904, 896,
+	897, 898, 899, 900, 901, 902, 895, 468, 469, 470,
+	560, 406, 84, 84, 1417, 468, 469, 470, 560, 403,
+	380, 52, 855, 856, 854, 292, 558, 1937, 468, 469,
+	470, 1682, 1176, 1936, 1515, 1935, 2089, 1129, 1934, 931,
+	956, 337, 1931, 843, 1925, 1117, 948, 1151, 1153, 1922,
+	1921, 1116, 1149, 1150, 468, 469, 470, 560, 1887, 844,
+	1830, 1823, 337, 1822, 2078, 405, 561, 1821, 955, 855,
+	856, 854, 402, 2123, 561, 1820, 420, 421, 422, 1817,
+	1676, 589, 1300, 84, 941, 1675, 961, 1683, 1674, 1206,
+	1673, 1208, 1113, 1480, 1114, 312, 1298, 1299, 1297, 1165,
+	1166, 1167, 1312, 721, 1126, 855, 856, 854, 1168, 1177,
+	1232, 1233, 2061, 561, 1957, 2022, 1191, 2009, 894, 893,
+	903, 904, 896, 897, 898, 899, 900, 901, 902, 895,
+	1163, 2008, 1140, 1939, 1932, 938, 1281, 1282, 1283, 1284,
 	1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 824, 824,
-	824, 1302, 1303, 1171, 1169, 1216, 1140, 1170, 1429, 1172,
-	1199, 794, 2178, 1173, 2008, 1318, 1939, 1932, 1202, 1559,
-	1183, 588, 468, 469, 470, 1203, 1204, 1205, 1928, 1320,
-	855, 856, 854, 1907, 1187, 1188, 1189, 2036, 1642, 1192,
-	1927, 1193, 1570, 1567, 1568, 1569, 1229, 1926, 1564, 1885,
-	1563, 1562, 1560, 1200, 1866, 855, 856, 854, 1831, 1272,
-	1398, 1737, 1735, 1684, 558, 1529, 1528, 1527, 2156, 1526,
-	1301, 1227, 1228, 1143, 1230, 1142, 939, 315, 314, 318,
-	1267, 1268, 1269, 1270, 1271, 320, 1895, 1277, 1278, 1279,
-	1280, 1309, 468, 469, 470, 560, 1314, 324, 934, 933,
-	1295, 722, 1323, 1413, 2183, 1310, 1311, 1561, 855, 856,
-	854, 757, 893, 903, 904, 896, 897, 898, 899, 900,
-	901, 902, 895, 1334, 1630, 1313, 1315, 1316, 1458, 2177,
-	2176, 1413, 1457, 1139, 2159, 1319, 346, 1321, 1322, 1649,
-	1653, 1655, 1657, 1659, 1660, 1662, 345, 1570, 1567, 1568,
-	1569, 561, 2016, 1644, 1645, 1646, 1647, 1628, 1629, 1650,
-	1965, 1631, 1902, 1632, 1633, 1634, 1635, 1636, 1637, 1638,
-	1639, 1640, 1641, 1648, 1145, 2155, 2154, 1139, 2143, 1139,
-	2142, 1652, 1654, 1656, 1658, 1661, 1901, 575, 2116, 2115,
-	1897, 2076, 1725, 319, 323, 758, 1337, 327, 759, 432,
-	1722, 329, 330, 331, 1897, 2071, 333, 334, 736, 1824,
-	1721, 1144, 1643, 1696, 337, 1195, 2059, 337, 1565, 1566,
-	432, 906, 337, 909, 2048, 2047, 1619, 1362, 1601, 1352,
-	1546, 855, 856, 854, 855, 856, 854, 907, 908, 905,
-	1545, 894, 893, 903, 904, 896, 897, 898, 899, 900,
-	901, 902, 895, 2146, 1461, 1392, 896, 897, 898, 899,
-	900, 901, 902, 895, 1459, 337, 1897, 2026, 1897, 2025,
-	1456, 1351, 1897, 2024, 1455, 84, 84, 1897, 2023, 1403,
-	864, 865, 866, 867, 868, 869, 870, 862, 1384, 1364,
-	1341, 2014, 2013, 1342, 1963, 1964, 1344, 1453, 894, 893,
+	824, 1302, 1303, 1928, 1170, 1216, 1172, 1173, 1171, 1169,
+	1199, 794, 1927, 1926, 1885, 1318, 1866, 1724, 1202, 1831,
+	1183, 588, 468, 469, 470, 1203, 1204, 1205, 1398, 1320,
+	893, 903, 904, 896, 897, 898, 899, 900, 901, 902,
+	895, 1192, 1642, 1193, 1737, 1735, 1229, 1187, 1188, 1189,
+	855, 856, 854, 1200, 1723, 1684, 1529, 1528, 1593, 1272,
+	896, 897, 898, 899, 900, 901, 902, 895, 1430, 1774,
+	1301, 1227, 1228, 1527, 1230, 2062, 855, 856, 854, 2178,
+	1267, 1268, 1269, 1270, 1271, 1295, 1526, 1277, 1278, 1279,
+	1280, 1309, 1143, 1142, 939, 934, 1314, 855, 856, 854,
+	2156, 933, 1323, 1985, 1777, 1310, 1311, 2037, 722, 2036,
+	1772, 1458, 2016, 1429, 1413, 1457, 1785, 1786, 1413, 2183,
+	1965, 1773, 1902, 1580, 1334, 855, 856, 854, 1630, 1901,
+	1313, 1315, 1316, 2177, 2176, 855, 856, 854, 1322, 1725,
+	1319, 1722, 1321, 1649, 1653, 1655, 1657, 1659, 1660, 1662,
+	1721, 1570, 1567, 1568, 1569, 1778, 1696, 1644, 1645, 1646,
+	1647, 1628, 1629, 1650, 1619, 1631, 1601, 1632, 1633, 1634,
+	1635, 1636, 1637, 1638, 1639, 1640, 1641, 1648, 898, 899,
+	900, 901, 902, 895, 1546, 1652, 1654, 1656, 1658, 1661,
+	855, 856, 854, 1139, 2159, 1545, 1337, 1461, 1145, 432,
+	864, 865, 866, 867, 868, 869, 870, 862, 736, 1907,
+	2155, 2154, 1459, 1454, 337, 346, 1643, 337, 1139, 2143,
+	432, 906, 337, 909, 1456, 345, 1455, 1362, 1453, 1352,
+	1422, 855, 856, 854, 1784, 1144, 1509, 907, 908, 905,
+	1895, 894, 893, 903, 904, 896, 897, 898, 899, 900,
+	901, 902, 895, 2121, 1419, 1392, 1139, 2142, 855, 856,
+	854, 1780, 855, 856, 854, 337, 575, 2116, 2115, 1897,
+	2076, 1351, 1897, 2071, 1412, 84, 84, 1195, 2059, 1403,
+	855, 856, 854, 1779, 1781, 2048, 2047, 1394, 1384, 1364,
+	1341, 1897, 2026, 1342, 1897, 2025, 1344, 1317, 894, 893,
+	903, 904, 896, 897, 898, 899, 900, 901, 902, 895,
+	1400, 1401, 1460, 1418, 751, 1360, 1361, 1339, 780, 1897,
+	2024, 402, 574, 19, 1340, 1824, 2134, 1354, 1717, 1388,
+	1897, 2023, 2014, 2013, 495, 1348, 473, 1389, 474, 1390,
+	474, 1787, 852, 52, 1363, 1963, 1964, 855, 856, 854,
+	855, 856, 854, 1775, 1163, 1963, 1962, 1383, 894, 893,
 	903, 904, 896, 897, 898, 899, 900, 901, 902, 895,
-	1400, 1401, 1422, 1418, 1419, 1360, 1361, 1354, 780, 1339,
-	1412, 402, 1394, 19, 1340, 1717, 1963, 1962, 1716, 1388,
-	1906, 1905, 1904, 1903, 1348, 1389, 1317, 1390, 751, 1715,
-	1897, 1896, 1599, 52, 1363, 1198, 1604, 855, 856, 854,
-	855, 856, 854, 1413, 1585, 1163, 574, 1383, 1413, 1571,
-	1396, 855, 856, 854, 855, 856, 854, 2134, 1774, 1413,
-	1393, 1413, 1421, 1413, 1420, 1198, 1338, 1402, 1399, 1437,
-	1333, 1332, 12, 1590, 6, 719, 5, 1391, 1327, 1326,
-	1408, 852, 1440, 1441, 2179, 1414, 1198, 1197, 1415, 1416,
-	1139, 1138, 475, 1777, 1324, 855, 856, 854, 949, 1772,
-	1472, 949, 1411, 1651, 1475, 1785, 1786, 725, 724, 495,
-	1773, 473, 1620, 474, 848, 474, 337, 1133, 1118, 1602,
-	337, 337, 1406, 476, 337, 850, 1478, 1330, 1424, 1425,
-	1426, 1427, 1428, 910, 1432, 1584, 476, 432, 1433, 1434,
-	1435, 1436, 1479, 1469, 1778, 1305, 1506, 2125, 1583, 84,
-	1195, 1439, 1147, 581, 546, 2119, 1467, 855, 856, 854,
-	2101, 79, 1474, 52, 2098, 1438, 1445, 2096, 405, 1449,
-	855, 856, 854, 2039, 1487, 1489, 1447, 84, 1551, 1582,
-	1471, 1977, 1295, 1462, 1530, 1452, 824, 1961, 1463, 1470,
-	1581, 1464, 824, 1473, 1476, 1477, 1889, 1481, 1577, 1959,
-	1482, 855, 856, 854, 1954, 1159, 1916, 1576, 1525, 75,
-	1575, 1483, 855, 856, 854, 1574, 1699, 1893, 1892, 1490,
-	855, 856, 854, 1784, 1891, 1509, 1888, 1533, 1534, 855,
-	856, 854, 855, 856, 854, 1877, 1862, 855, 856, 854,
-	1535, 1536, 1573, 1598, 1801, 1798, 1537, 1797, 1701, 584,
-	1780, 1710, 1713, 1128, 1595, 1556, 1678, 1671, 1296, 337,
-	75, 1597, 1550, 1555, 855, 856, 854, 1366, 1343, 1551,
-	1325, 84, 1779, 1781, 1553, 1196, 1589, 855, 856, 854,
-	1664, 1554, 1185, 1178, 1572, 855, 856, 854, 1586, 940,
-	937, 1578, 1579, 2106, 936, 1304, 1588, 935, 1594, 932,
-	880, 929, 927, 855, 856, 854, 1618, 926, 925, 1592,
-	1600, 920, 892, 1605, 891, 1596, 1617, 855, 856, 854,
-	1603, 890, 1695, 889, 1681, 888, 886, 885, 884, 883,
-	1787, 882, 719, 881, 1679, 1608, 52, 878, 1668, 877,
-	876, 875, 1775, 874, 873, 872, 871, 733, 716, 477,
-	1663, 1667, 1627, 1667, 1669, 1122, 1123, 1672, 2104, 2067,
-	1677, 452, 455, 456, 457, 453, 1378, 454, 458, 1194,
-	1125, 306, 1686, 497, 745, 743, 1127, 337, 337, 746,
-	744, 84, 742, 741, 1702, 1703, 1704, 747, 1685, 456,
-	457, 432, 2163, 1743, 1328, 2081, 565, 1711, 566, 1714,
-	1506, 1708, 1164, 1149, 1150, 1606, 1493, 501, 1500, 1694,
-	1157, 447, 1607, 503, 804, 1833, 1732, 1499, 846, 1719,
-	460, 338, 452, 455, 456, 457, 453, 2123, 454, 458,
-	1788, 1728, 1729, 1727, 1226, 1225, 1806, 1808, 1112, 1806,
-	1806, 1718, 1730, 2120, 1768, 2044, 1740, 2042, 1792, 432,
-	507, 508, 1795, 1796, 1720, 1793, 1794, 1996, 452, 455,
-	456, 457, 453, 824, 454, 458, 1799, 1995, 1802, 1803,
-	1993, 1807, 894, 893, 903, 904, 896, 897, 898, 899,
-	900, 901, 902, 895, 1919, 1917, 1736, 1693, 2121, 1616,
-	1615, 1809, 1810, 1549, 346, 506, 1811, 345, 1548, 1405,
-	1726, 2107, 719, 1423, 345, 2108, 2107, 459, 1345, 284,
-	2108, 358, 1819, 1, 1273, 509, 1837, 729, 417, 441,
-	726, 440, 438, 74, 1306, 1238, 664, 944, 1827, 950,
-	1955, 2080, 1812, 894, 893, 903, 904, 896, 897, 898,
-	899, 900, 901, 902, 895, 894, 893, 903, 904, 896,
-	897, 898, 899, 900, 901, 902, 895, 1865, 84, 2112,
-	2038, 1840, 2083, 652, 636, 1988, 1494, 1908, 1990, 1681,
-	1910, 1460, 1358, 1826, 1355, 498, 1465, 1466, 677, 1788,
-	667, 928, 1808, 668, 1863, 1825, 1838, 1839, 711, 1842,
+	1396, 1413, 1393, 1906, 1905, 1904, 1903, 1402, 1716, 1437,
+	1399, 1715, 719, 12, 1391, 6, 850, 5, 1897, 1896,
+	1408, 475, 1440, 1441, 1324, 1414, 1599, 1411, 1415, 1416,
+	855, 856, 854, 855, 856, 854, 1198, 1604, 949, 1620,
+	1472, 949, 1413, 1585, 1475, 1413, 1571, 1651, 855, 856,
+	854, 1413, 1421, 1133, 848, 1118, 337, 1413, 1420, 1602,
+	337, 337, 1198, 1338, 337, 476, 1478, 1406, 1424, 1425,
+	1426, 1427, 1428, 910, 1432, 1333, 1332, 432, 1433, 1434,
+	1435, 1436, 1479, 1469, 1327, 1326, 1506, 1198, 1197, 84,
+	476, 1439, 1139, 1138, 725, 724, 1330, 1305, 1467, 1195,
+	1147, 581, 79, 52, 1474, 1438, 1445, 1295, 546, 1449,
+	2179, 2125, 1447, 2119, 1487, 1489, 2101, 84, 1551, 2163,
+	1471, 1590, 2098, 1462, 1530, 1452, 824, 405, 2096, 1464,
+	1463, 1584, 824, 1473, 1583, 1476, 2039, 1477, 1481, 1470,
+	1582, 1482, 1977, 855, 856, 854, 1961, 1959, 1954, 1916,
+	75, 1525, 1699, 855, 856, 854, 855, 856, 854, 1893,
+	1892, 1483, 855, 856, 854, 1891, 1888, 1533, 1534, 1490,
+	903, 904, 896, 897, 898, 899, 900, 901, 902, 895,
+	1535, 1536, 1581, 1598, 1877, 1862, 1801, 1798, 1537, 1797,
+	1701, 584, 1710, 1889, 1595, 1577, 1713, 1678, 1671, 337,
+	1296, 1597, 1550, 1576, 855, 856, 854, 75, 1366, 1551,
+	1343, 84, 1325, 1196, 1553, 1185, 1589, 855, 856, 854,
+	1664, 1575, 1178, 940, 1572, 855, 856, 854, 937, 936,
+	935, 1578, 1579, 1159, 1586, 1574, 1588, 932, 880, 1594,
+	929, 927, 926, 855, 856, 854, 1618, 1573, 925, 1592,
+	920, 1600, 892, 1605, 891, 1596, 1617, 855, 856, 854,
+	1603, 890, 1695, 889, 1681, 888, 1556, 886, 885, 855,
+	856, 854, 884, 883, 1679, 882, 52, 1608, 1668, 881,
+	2106, 878, 1555, 322, 877, 321, 325, 317, 855, 856,
+	854, 1627, 1667, 1663, 1667, 876, 1669, 313, 1672, 875,
+	874, 873, 872, 1677, 855, 856, 854, 871, 332, 733,
+	306, 716, 1554, 477, 2104, 1686, 2067, 337, 337, 1378,
+	1304, 84, 719, 1194, 1702, 1703, 1704, 1125, 1685, 1122,
+	1123, 432, 497, 1743, 855, 856, 854, 1711, 1128, 1714,
+	1506, 1708, 855, 856, 854, 745, 1127, 742, 741, 1694,
+	746, 452, 455, 456, 457, 453, 1732, 454, 458, 1719,
+	338, 1328, 452, 455, 456, 457, 453, 1726, 454, 458,
+	1788, 1728, 1729, 743, 2081, 1727, 1806, 1808, 744, 1806,
+	1806, 1718, 1730, 565, 566, 1164, 1740, 447, 1792, 432,
+	1493, 1768, 1795, 1796, 1720, 1793, 1794, 501, 452, 455,
+	456, 457, 453, 824, 454, 458, 1799, 1149, 1150, 1803,
+	1802, 1807, 894, 893, 903, 904, 896, 897, 898, 899,
+	900, 901, 902, 895, 747, 1500, 456, 457, 1606, 1157,
+	804, 1809, 1810, 1833, 1499, 1607, 1811, 894, 893, 903,
+	904, 896, 897, 898, 899, 900, 901, 902, 895, 846,
+	460, 1112, 1819, 1226, 1225, 503, 1837, 345, 315, 314,
+	318, 507, 508, 2120, 2044, 2042, 320, 1996, 1827, 1995,
+	1993, 1919, 1812, 1917, 1736, 1693, 1616, 1615, 324, 1549,
+	346, 506, 1548, 1405, 719, 2108, 2107, 459, 1423, 1345,
+	345, 284, 757, 2107, 2108, 358, 1, 1865, 84, 1273,
+	509, 1840, 729, 417, 441, 726, 440, 438, 74, 1681,
+	1306, 1238, 664, 944, 950, 1955, 2080, 2112, 2038, 1788,
+	2083, 652, 1808, 636, 1863, 1825, 1838, 1839, 1988, 1842,
 	1843, 1844, 1845, 1881, 1867, 1848, 1849, 1850, 1851, 1852,
-	1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 419,
-	1920, 1886, 666, 1818, 1542, 347, 1894, 894, 893, 903,
-	904, 896, 897, 898, 899, 900, 901, 902, 895, 416,
-	359, 1953, 1882, 1611, 1789, 1712, 1800, 1898, 1698, 1235,
-	2172, 466, 2162, 2138, 2118, 2004, 2157, 2049, 2099, 2092,
-	1918, 2000, 1834, 310, 811, 540, 383, 467, 1978, 432,
-	1933, 391, 432, 432, 432, 734, 1518, 1372, 432, 1155,
-	52, 1134, 762, 311, 2029, 1960, 350, 1899, 1158, 351,
-	1161, 1160, 1923, 1924, 1217, 863, 1294, 1998, 1929, 1930,
-	1966, 1587, 930, 1974, 1975, 1976, 918, 1984, 1973, 591,
-	1446, 1983, 643, 637, 1539, 1538, 1783, 799, 26, 461,
+	1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1494,
+	1920, 1886, 1908, 1990, 1910, 1358, 1894, 1826, 1355, 498,
+	1465, 1466, 677, 667, 928, 668, 711, 419, 666, 1818,
+	1542, 1953, 347, 416, 319, 323, 758, 1898, 327, 759,
+	359, 466, 329, 330, 331, 1882, 1611, 333, 334, 1789,
+	1918, 1712, 1698, 1235, 2172, 2162, 2138, 467, 2118, 432,
+	1933, 2004, 432, 432, 432, 2157, 2049, 2099, 432, 2092,
+	52, 2000, 1834, 310, 811, 540, 383, 1899, 1978, 391,
+	734, 1518, 1923, 1924, 1372, 1155, 1134, 1998, 1929, 1930,
+	1966, 1587, 762, 1974, 1975, 1976, 311, 1984, 1973, 2029,
+	1960, 1983, 350, 1158, 351, 1161, 1160, 1217, 863, 1294,
 	1999, 1992, 894, 893, 903, 904, 896, 897, 898, 899,
-	900, 901, 902, 895, 853, 84, 2006, 2007, 958, 665,
-	86, 1175, 432, 959, 1997, 1828, 2085, 651, 650, 649,
-	648, 451, 449, 1444, 448, 302, 301, 851, 432, 2064,
-	2063, 2018, 2019, 1733, 2012, 1876, 1940, 1872, 1868, 2010,
-	841, 1742, 1741, 2021, 894, 893, 903, 904, 896, 897,
-	898, 899, 900, 901, 902, 895, 1769, 1770, 1776, 2027,
-	1626, 1622, 1624, 1625, 2035, 1623, 2043, 2041, 2045, 2046,
-	1621, 1504, 1505, 1502, 1501, 1124, 1120, 2052, 2054, 946,
-	953, 426, 778, 81, 300, 1201, 11, 18, 2060, 17,
-	2087, 16, 47, 46, 45, 2072, 2073, 2074, 2075, 2091,
-	2017, 44, 15, 2086, 8, 43, 42, 41, 14, 13,
-	37, 36, 35, 34, 2095, 33, 2097, 2090, 894, 893,
-	903, 904, 896, 897, 898, 899, 900, 901, 902, 895,
+	900, 901, 902, 895, 930, 84, 2006, 2007, 918, 591,
+	1446, 643, 432, 637, 1539, 1538, 1783, 799, 26, 461,
+	853, 958, 665, 1444, 86, 1175, 959, 1997, 432, 1828,
+	2085, 651, 650, 649, 2012, 648, 451, 449, 448, 302,
+	841, 301, 851, 2021, 894, 893, 903, 904, 896, 897,
+	898, 899, 900, 901, 902, 895, 2064, 2063, 2018, 2027,
+	2019, 1733, 1876, 1940, 2035, 1872, 2043, 2041, 2045, 2046,
+	1868, 2010, 1742, 1741, 1769, 1770, 1776, 2052, 2054, 1626,
+	1622, 1624, 1625, 1623, 1621, 1504, 1505, 1502, 2060, 1501,
+	2087, 1124, 1120, 946, 953, 2072, 2073, 2074, 2075, 2091,
+	2017, 426, 778, 2086, 81, 300, 1201, 11, 18, 17,
+	16, 47, 46, 45, 2095, 44, 2097, 2090, 15, 8,
+	43, 42, 41, 14, 13, 37, 36, 35, 34, 33,
 	32, 2102, 31, 30, 2105, 2103, 29, 28, 27, 2114,
 	9, 56, 55, 2109, 54, 53, 20, 432, 21, 432,
 	2111, 22, 2077, 62, 61, 60, 767, 2122, 767, 2124,
@@ -3086,15 +3086,15 @@ var yyAct = [...]int{
 }
 
 var yyPact = [...]int{
-	338, -1000, -301, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
+	160, -1000, -299, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-	-1000, -1000, -1000, 17783, 1728, -1000, 7914, -1000, -1000, -1000,
-	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 211, 14787,
+	-1000, -1000, -1000, 17783, 1770, -1000, 7914, -1000, -1000, -1000,
+	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 247, 14787,
 	18211, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 7468, 7022,
-	100, -1000, 1719, -1000, -1000, -1000, -1000, 120, -1000, -1000,
-	-1000, -1000, -1000, -1000, -1000, -1000, 422, -54, 299, 305,
-	536, 536, 8770, 1719, 1385, 160, 10, -1000, 17355, 710,
-	338, 152, 18211, -1000, 353, -1000, -1000, -1000, -1000, -1000,
+	118, -1000, 1765, -1000, -1000, -1000, -1000, 129, -1000, -1000,
+	-1000, -1000, -1000, -1000, -1000, -1000, 320, -40, 338, 343,
+	573, 573, 8770, 1765, 1386, 169, 32, -1000, 17355, 668,
+	160, 175, 18211, -1000, 383, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
@@ -3114,74 +3114,74 @@ var yyPact = [...]int{
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-	-1000, -1000, -1000, -1000, 14787, 18211, -88, 502, -1000, 183,
-	195, 176, 351, -1000, -1000, -1000, -1000, 18211, 1611, -1000,
-	-1000, -1000, 1627, 18640, 160, -1000, 1290, 1311, -1000, -1000,
-	1525, -1000, 99, -14, -34, 70, -1000, -1000, 121, -1000,
-	-1000, -1000, -1000, -1000, 25, -1000, -20, -1000, -26, -1000,
-	-1000, -1000, -119, -1000, -1000, -1000, -1000, -1000, 1288, 331,
-	1552, -184, 1610, 1626, 1385, 1709, 1660, -17, 172, 172,
-	209, 172, -1000, -1000, -1000, -1000, -1000, -1000, 539, 137,
-	-1000, -1000, -132, -136, 383, -136, -10, -1000, -1000, -1000,
-	-1000, -1000, -1000, 174, -1000, -195, -1000, 287, -1000, 283,
-	-1000, 10501, 118, 1329, 475, -1000, 553, 553, 18211, 18211,
-	18211, 553, 955, 730, 347, -1000, -1000, -1000, 1596, 1598,
-	1626, 1385, -1000, 1719, 1719, 1220, 1051, 174, 174, 174,
-	174, 174, 1328, 18211, -1000, 1425, 5262, 5262, -1000, -1000,
-	-1000, -1000, -1000, -1000, -1000, -1000, 154, 1524, -1000, 18211,
-	1550, -1000, 345, 801, 961, -1000, -1000, 183, 1282, -1000,
-	491, -1000, -1000, -1000, -1000, 18211, 1523, 18211, 14787, 14787,
-	14787, 14787, -1000, 1572, 1571, -1000, 1564, 1563, 1576, 18211,
+	-1000, -1000, -1000, -1000, 14787, 18211, -75, 509, -1000, 207,
+	192, 188, 371, -1000, -1000, -1000, -1000, 18211, 1647, -1000,
+	-1000, -1000, 1717, 18640, 169, -1000, 1205, 1300, -1000, -1000,
+	1549, -1000, 97, -5, -20, 101, -1000, -1000, 146, -1000,
+	-1000, -1000, -1000, -1000, 49, -1000, -6, -1000, -4, -1000,
+	-1000, -1000, -115, -1000, -1000, -1000, -1000, -1000, 1203, 377,
+	1571, -183, 1660, 1728, 1386, 1755, 1731, -10, 206, 206,
+	242, 206, -1000, -1000, -1000, -1000, -1000, -1000, 553, 178,
+	-1000, -1000, -123, -139, 415, -139, -11, -1000, -1000, -1000,
+	-1000, -1000, -1000, 208, -1000, -195, -1000, 326, -1000, 315,
+	-1000, 10501, 142, 1343, 524, -1000, 562, 562, 18211, 18211,
+	18211, 562, 767, 720, 369, -1000, -1000, -1000, 1643, 1644,
+	1728, 1386, -1000, 1765, 1765, 1186, 1130, 208, 208, 208,
+	208, 208, 1336, 18211, -1000, 1427, 5262, 5262, -1000, -1000,
+	-1000, -1000, -1000, -1000, -1000, -1000, 177, 1547, -1000, 18211,
+	1600, -1000, 367, 808, 968, -1000, -1000, 207, 1329, -1000,
+	577, -1000, -1000, -1000, -1000, 18211, 1545, 18211, 14787, 14787,
+	14787, 14787, -1000, 1597, 1596, -1000, 1622, 1594, 1673, 18211,
 	-1000, -1000, -1000, 18993, -1000, -1000, -1000, -1000, -1000, -1000,
-	-1000, 1202, 1719, 102, 816, 13931, 16071, 18211, 13931, -1000,
-	-1000, -1000, -1000, -1000, -120, -1000, -1000, -1000, -1000, -1000,
-	-1000, -1000, -1000, -1000, -1000, 102, 13931, 13931, -94, -1000,
-	-1000, -289, 1610, 5700, -1000, -1000, 5700, -1000, -1000, 193,
-	172, -1000, 13931, 577, 16071, 885, 18211, 18211, -1000, -1000,
-	383, 383, -1000, 539, 539, -1000, -1000, -121, 1720, 6576,
-	-130, 18211, 172, 16927, 1620, -155, 297, 281, 291, -1000,
-	-1000, -192, -1000, -1000, 1298, 11363, 9627, 207, 13931, 3504,
-	-1000, -1000, 3504, 553, 553, 553, 3504, 326, -1000, -1000,
-	-1000, -1000, -1000, -1000, 18211, -1000, -1000, 1610, -1000, -1000,
-	-1000, 1626, 1610, 1626, -1000, -1000, 13931, 16071, 18211, 18211,
-	19346, 18211, 1328, 1625, 18211, 1300, -1000, -1000, 9199, 344,
-	5700, 1111, 1522, -1000, -1000, 1521, 1520, 1519, 1517, 1516,
-	1515, 1513, -1000, 1476, -1000, -1000, 1509, 1507, 1505, 1504,
-	-1000, -1000, -1000, -1000, -1000, -1000, 1503, -1000, -1000, -1000,
-	1502, 1476, -1000, -1000, 1501, 1499, 1497, 1490, 1488, -1000,
+	-1000, 1178, 1765, 114, 1567, 13931, 16071, 18211, 13931, -1000,
+	-1000, -1000, -1000, -1000, -127, -1000, -1000, -1000, -1000, -1000,
+	-1000, -1000, -1000, -1000, -1000, 114, 13931, 13931, -84, -1000,
+	-1000, -287, 1660, 5700, -1000, -1000, 5700, -1000, -1000, 226,
+	206, -1000, 13931, 605, 16071, 885, 18211, 18211, -1000, -1000,
+	415, 415, -1000, 553, 553, -1000, -1000, -134, 1762, 6576,
+	-121, 18211, 206, 16927, 1696, -158, 336, 327, 330, -1000,
+	-1000, -186, -1000, -1000, 1325, 11363, 9627, 211, 13931, 3504,
+	-1000, -1000, 3504, 562, 562, 562, 3504, 354, -1000, -1000,
+	-1000, -1000, -1000, -1000, 18211, -1000, -1000, 1660, -1000, -1000,
+	-1000, 1728, 1660, 1728, -1000, -1000, 13931, 16071, 18211, 18211,
+	19346, 18211, 1336, 1716, 18211, 1251, -1000, -1000, 9199, 366,
+	5700, 1031, 1543, -1000, -1000, 1538, 1537, 1536, 1535, 1531,
+	1520, 1517, -1000, 1474, -1000, -1000, 1515, 1511, 1509, 1508,
+	-1000, -1000, -1000, -1000, -1000, -1000, 1504, -1000, -1000, -1000,
+	1503, 1474, -1000, -1000, 1501, 1499, 1497, 1490, 1488, -1000,
 	-1000, -1000, -1000, 1060, -1000, -1000, -1000, -1000, 3066, 6576,
-	6576, 6576, 6576, -1000, -1000, 1436, 5700, 1487, -1000, -1000,
+	6576, 6576, 6576, -1000, -1000, 1443, 5700, 1486, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-	-1000, -1000, 10929, -1000, 1484, 1483, 1478, 1477, 1476, 1475,
-	959, 958, 1473, 1470, 1466, 6576, 936, 1465, -1000, -1000,
+	-1000, -1000, 10929, -1000, 1484, 1478, 1477, 1476, 1474, 1473,
+	961, 955, 1466, 1465, 1464, 6576, 954, 1459, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-	1300, -1000, -287, -1000, 10067, 18211, 18211, -1000, 1712, 5700,
-	2186, -1000, 1649, -1000, 183, 61, -1000, -1000, -1000, -1000,
-	-1000, -1000, 337, 18211, 1293, -1000, 470, 1534, 1549, 1534,
-	-1000, -1000, -1000, -1000, 1565, -1000, 1442, -1000, -1000, 1425,
-	-1000, -1000, 529, -1000, -1000, -1000, -1000, -1000, -20, -26,
-	1292, -1000, -49, 92, -1000, -1000, 1265, -1000, -1000, -1000,
-	529, 1292, 190, 935, 933, -1000, 1076, 336, 1327, -1000,
-	759, 16499, 18211, 217, 1616, 1298, 1383, 1603, 1720, 1720,
-	1720, 383, 19346, 539, 18211, 539, -1000, -1000, 539, -1000,
-	334, 18211, 217, 1459, -1000, -1000, -1000, 295, 282, 279,
-	16071, 186, -1000, -1000, 1298, -1000, -1000, -1000, 1458, 468,
-	-1000, -1000, 6576, -1000, 606, -1000, -1000, 3504, 3504, 3504,
-	-1000, 12647, -1000, -1000, 1610, -1000, 1610, 1292, 1298, 1548,
-	1325, -1000, -1000, -1000, -1000, -1000, 1451, 1261, -1000, 1720,
+	1251, -1000, -285, -1000, 10067, 18211, 18211, -1000, 1732, 5700,
+	2186, -1000, 1722, -1000, 207, 70, -1000, -1000, -1000, -1000,
+	-1000, -1000, 364, 18211, 1290, -1000, 502, 1568, 1566, 1568,
+	-1000, -1000, -1000, -1000, 1595, -1000, 1587, -1000, -1000, 1427,
+	-1000, -1000, 597, -1000, -1000, -1000, -1000, -1000, -6, -4,
+	1288, -1000, -42, 92, -1000, -1000, 1327, -1000, -1000, -1000,
+	597, 1288, 224, 953, 952, -1000, 1100, 363, 1335, -1000,
+	797, 16499, 18211, 227, 1695, 1325, 1471, 1646, 1762, 1762,
+	1762, 415, 19346, 553, 18211, 553, -1000, -1000, 553, -1000,
+	362, 18211, 227, 1458, -1000, -1000, -1000, 334, 314, 311,
+	16071, 222, -1000, -1000, 1325, -1000, -1000, -1000, 1451, 501,
+	-1000, -1000, 6576, -1000, 714, -1000, -1000, 3504, 3504, 3504,
+	-1000, 12647, -1000, -1000, 1660, -1000, 1660, 1288, 1325, 1562,
+	1334, -1000, -1000, -1000, -1000, -1000, 1449, 1322, -1000, 1762,
 	5262, -1000, 14787, -1000, 5700, 5700, 5700, -1000, 15643, -1000,
 	15215, -1000, 240, 6138, -1000, -1000, -1000, -1000, -1000, -1000,
-	-1000, 5700, 1644, 1644, 1644, 5700, 635, 5700, 5700, -1000,
-	653, 7020, 1644, 1644, 1644, 1644, 1644, -1000, 2620, 1644,
-	1644, 1644, 1644, 6576, 6576, 6576, 6576, 6576, 6576, 6576,
-	6576, 6576, 6576, 6576, 6576, 1434, 579, 6576, 6576, 6576,
-	1051, 1469, 1320, -1000, -1000, -1000, -1000, -1000, 528, 606,
-	5700, -1000, 7020, 7020, 799, 5700, 5700, 5700, -1000, 1200,
+	-1000, 5700, 1723, 1723, 1723, 5700, 635, 5700, 5700, -1000,
+	665, 7020, 1723, 1723, 1723, 1723, 1723, -1000, 2620, 1723,
+	1723, 1723, 1723, 6576, 6576, 6576, 6576, 6576, 6576, 6576,
+	6576, 6576, 6576, 6576, 6576, 1436, 769, 6576, 6576, 6576,
+	1130, 1554, 1332, -1000, -1000, -1000, -1000, -1000, 574, 714,
+	5700, -1000, 7020, 7020, 807, 5700, 5700, 5700, -1000, 1161,
 	-1000, -1000, 5700, -1000, -1000, 5700, 6576, 5700, -1000, -1000,
-	1644, 1720, 1269, -1000, 1446, -1000, 1253, 1591, -1000, 328,
-	1302, -1000, 403, 1245, -1000, 1626, 606, -1000, 321, -1000,
+	1723, 1762, 1259, -1000, 1448, -1000, 1319, 1618, -1000, 361,
+	1331, -1000, 494, 1310, -1000, 1728, 714, -1000, 356, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
@@ -3197,154 +3197,154 @@ var yyPact = [...]int{
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-	-1000, -1000, -90, -1000, -1000, 18211, 1240, 1712, 18211, 5700,
-	-1000, -1000, 5700, 1444, -1000, 5700, -1000, -1000, -1000, -1000,
-	1727, 316, 315, 13931, -1000, 148, 13931, -1000, -1000, 18211,
-	184, 13931, -18, -140, 5700, 5700, 18211, 5700, -1000, -1000,
-	-1000, 1425, 564, 1443, -239, -1000, -65, -1000, 1545, 63,
-	-1000, 1603, -1000, 322, -1000, -1000, -1000, -1000, 1720, -1000,
-	383, -1000, 383, 539, 18211, -1000, -1000, -239, 1186, -1000,
-	-1000, -1000, 274, 1298, 13931, 920, 207, -1000, -1000, -1000,
-	-1000, -1000, -1000, -1000, 18211, 18211, 338, -1000, 18211, 1716,
-	-1000, 1297, 1647, -1000, 634, 584, -1000, -1000, 314, -1000,
-	-1000, 280, -1000, -1000, -1000, -1000, -1000, 1436, -1000, -1000,
-	-1000, 1184, 1234, 606, 5700, -1000, -1000, 5700, 5700, 685,
-	5700, 1178, 1238, 1236, -1000, 1176, -1000, 1722, -1000, -1000,
+	-1000, -1000, -81, -1000, -1000, 18211, 1297, 1732, 18211, 5700,
+	-1000, -1000, 5700, 1446, -1000, 5700, -1000, -1000, -1000, -1000,
+	1768, 355, 353, 13931, -1000, 155, 13931, -1000, -1000, 18211,
+	209, 13931, -12, -143, 5700, 5700, 18211, 5700, -1000, -1000,
+	-1000, 1427, 584, 1444, -233, -1000, -57, -1000, 1558, 108,
+	-1000, 1646, -1000, 535, -1000, -1000, -1000, -1000, 1762, -1000,
+	415, -1000, 415, 553, 18211, -1000, -1000, -233, 1151, -1000,
+	-1000, -1000, 312, 1325, 13931, 888, 211, -1000, -1000, -1000,
+	-1000, -1000, -1000, -1000, 18211, 18211, 160, -1000, 18211, 1760,
+	-1000, 1302, 1611, -1000, 589, 540, -1000, -1000, 352, -1000,
+	-1000, 350, -1000, -1000, -1000, -1000, -1000, 1443, -1000, -1000,
+	-1000, 1138, 1236, 714, 5700, -1000, -1000, 5700, 5700, 761,
+	5700, 1118, 1292, 1286, -1000, 1094, -1000, 1767, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, 5700, 5700, 5700,
-	5700, 5700, 872, 4824, -1000, -1000, -1000, 5700, 5700, 5700,
-	5700, 788, 930, -1000, 591, 591, 357, 357, 357, 357,
-	357, 1071, 1071, -1000, -1000, -1000, 3066, 1434, 6576, 6576,
-	6576, 158, 1967, 1893, -1000, 5700, 583, -1000, 5700, 725,
-	-1000, -1000, 7020, 1161, 824, 1138, 1134, -1000, 996, 1128,
-	1746, 1118, 5700, 1716, -287, 4380, 169, 18211, -287, 18211,
-	18211, 4380, -1000, 18211, -1000, 2186, 798, -1000, -1000, 1626,
-	-1000, 606, 606, 18211, 606, 13931, 368, 486, -1000, 12219,
-	13931, -1000, -1000, 13931, 117, 1609, -1000, -1000, -108, -100,
-	606, 606, 313, -1000, 1624, 1614, 8342, -1000, -79, -1000,
-	-1000, -1000, 275, -1000, 929, 927, 926, 925, 18211, -1000,
-	-1000, -1000, -1000, -1000, 397, 397, 397, 1596, -1000, 1720,
-	1720, 383, -1000, -28, -56, -1000, 1292, 1104, -1000, -1000,
-	-1000, -1000, 1094, -1000, 1714, 1707, 14787, 14359, -1000, -1000,
-	-1000, -1000, -1000, 5700, 1455, 1437, 1429, 823, 1223, -1000,
-	-1000, -1000, -1000, 5700, 1416, 1389, 1384, 1381, 1372, -1000,
-	5700, 5700, 671, 1364, 1353, 1322, 1309, 1218, -1000, 158,
-	1967, 1841, -1000, 6576, 6576, 1247, 516, -1000, 5700, 676,
-	823, 385, -1000, -1000, 5700, -1000, -1000, -1000, 385, -1000,
-	6576, -1000, 1206, 1714, -1000, 1092, 1294, -1000, -287, -1000,
-	-1000, 1269, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-	-1000, -1000, 1210, 1292, -1000, -1000, -1000, -1000, 13931, 1619,
-	217, -1000, -16, 196, -294, -96, 1704, 1703, 18211, 160,
-	18211, 1090, 1287, -1000, -1000, -1000, 928, 549, -1000, 18211,
-	627, 323, 172, 323, 603, 1433, -1000, -1000, -79, -1000,
-	795, 792, 791, 789, -55, -1000, -1000, -1000, -1000, -1000,
-	1432, 385, -1000, 636, 923, -1000, -1000, 1720, -1000, -28,
-	-1000, 261, 258, 9, 1701, -1000, -1000, -1000, 5700, 5700,
-	1647, -1000, -1000, 606, -1000, -1000, -1000, 1077, -1000, 1392,
-	1424, -1000, 1392, 1392, 1392, 267, 267, 1427, 1427, 1428,
-	1427, -1000, 1203, -1000, -1000, -1000, -1000, -1000, 1192, 1189,
+	5700, 5700, 977, 4824, -1000, -1000, -1000, 5700, 5700, 5700,
+	5700, 1357, 848, -1000, 991, 991, 394, 394, 394, 394,
+	394, 875, 875, -1000, -1000, -1000, 3066, 1436, 6576, 6576,
+	6576, 193, 1626, 1893, -1000, 5700, 598, -1000, 5700, 676,
+	-1000, -1000, 7020, 1092, 1122, 1090, 1088, -1000, 979, 1076,
+	1177, 1061, 5700, 1760, -285, 4380, 186, 18211, -285, 18211,
+	18211, 4380, -1000, 18211, -1000, 2186, 798, -1000, -1000, 1728,
+	-1000, 714, 714, 18211, 714, 13931, 418, 539, -1000, 12219,
+	13931, -1000, -1000, 13931, 109, 1653, -1000, -1000, -99, -91,
+	714, 714, 351, -1000, 1701, 1691, 8342, -1000, -73, -1000,
+	-1000, -1000, 217, -1000, 946, 933, 917, 916, 18211, -1000,
+	-1000, -1000, -1000, -1000, 469, 469, 469, 1643, -1000, 1762,
+	1762, 415, -1000, -8, -45, -1000, 1288, 1059, -1000, -1000,
+	-1000, -1000, 1048, -1000, 1758, 1753, 14787, 14359, -1000, -1000,
+	-1000, -1000, -1000, 5700, 1546, 1516, 1500, 239, 1280, -1000,
+	-1000, -1000, -1000, 5700, 1481, 1469, 1455, 1437, 1429, -1000,
+	5700, 5700, 1032, 1416, 1374, 1368, 1365, 1277, -1000, 193,
+	1626, 1841, -1000, 6576, 6576, 1355, 528, -1000, 5700, 892,
+	239, 728, -1000, -1000, 5700, -1000, -1000, -1000, 728, -1000,
+	6576, -1000, 1260, 1758, -1000, 1030, 1294, -1000, -285, -1000,
+	-1000, 1259, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
+	-1000, -1000, 1271, 1288, -1000, -1000, -1000, -1000, 13931, 1702,
+	227, -1000, -3, 245, -289, -86, 1751, 1750, 18211, 169,
+	18211, 1028, 1274, -1000, -1000, -1000, 932, 554, -1000, 18211,
+	618, 346, 206, 346, 614, 1434, -1000, -1000, -73, -1000,
+	795, 793, 790, 785, -48, -1000, -1000, -1000, -1000, -1000,
+	1433, 728, -1000, 741, 915, -1000, -1000, 1762, -1000, -8,
+	-1000, 274, 278, 29, 1749, -1000, -1000, -1000, 5700, 5700,
+	1611, -1000, -1000, 714, -1000, -1000, -1000, 1020, -1000, 1388,
+	1426, -1000, 1388, 1388, 1388, 303, 303, 1428, 1428, 1432,
+	1428, -1000, 1245, -1000, -1000, -1000, -1000, -1000, 1242, 1192,
 	5700, -1000, -1000, -1000, -1000, -1000, -1000, 6576, -1000, -1000,
-	-1000, -1000, 606, 5700, 1074, 1064, 611, 1056, 1674, -1000,
-	-1000, -1000, 4380, 1269, -1000, -1000, 13931, 13931, -240, -21,
-	18211, -296, 922, -1000, 1700, 921, 807, -1000, 1425, 19736,
-	8342, 1259, -42, -1000, -1000, -1000, 1392, -1000, 1424, 1424,
-	1392, 1392, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-	-1000, 1423, 1421, -1000, 1392, 1420, 1392, 1392, -1000, -1000,
+	-1000, -1000, 714, 5700, 1014, 1005, 918, 1003, 1601, -1000,
+	-1000, -1000, 4380, 1259, -1000, -1000, 13931, 13931, -234, -7,
+	18211, -291, 905, -1000, 1748, 904, 673, -1000, 1427, 19736,
+	8342, 960, -28, -1000, -1000, -1000, 1388, -1000, 1426, 1426,
+	1388, 1388, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
+	-1000, 1425, 1423, -1000, 1388, 1422, 1422, 1388, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, 18211, 18211, -1000, 18211, 18211,
-	172, 5700, -1000, -1000, -1000, -1000, -1000, -1000, 13503, -1000,
-	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 787,
-	-1000, -1000, -1000, 920, 606, 1234, -1000, -1000, -1000, 783,
-	-1000, 776, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-	766, -1000, -1000, 765, -1000, -1000, -1000, -1000, 1073, -1000,
-	606, -1000, -1000, -1000, 5700, -1000, -1000, -1000, -1000, -1000,
-	-1000, -1000, -130, -298, 763, -1000, 918, -99, -1000, -1000,
-	1622, 139, 19624, -1000, 397, 397, 350, 397, 397, 397,
-	397, 96, 95, 397, 397, 397, 397, 397, 397, 397,
-	397, 397, 397, 397, 397, 397, 397, 1412, -1000, -1000,
-	1259, -1000, -1000, 618, 6576, -1000, -1000, 914, 636, 372,
-	438, 1411, -1000, 69, 596, 594, -1000, 18211, -1000, -46,
-	-1000, -1000, -1000, -1000, -1000, -1000, -1000, 909, 909, -1000,
-	-1000, 762, -1000, -1000, 1402, 1374, 34, 1400, -1000, 1394,
-	1393, 18211, 950, 1205, -1000, 1392, 5700, 4, -1000, -1000,
-	1050, 1026, 1197, 1195, -1000, 897, -114, -107, -1000, 1382,
-	-1000, -1000, 1699, 160, -1000, 1698, 19736, -1000, 758, 756,
-	397, 397, 754, 907, 900, 888, 397, 397, 749, 877,
-	18993, 736, 721, 702, 780, 876, 410, 769, 768, 707,
-	18211, 1380, 822, -1000, -1000, 1967, -1000, -1000, -1000, -1000,
-	-1000, -1000, -1000, -1000, -1000, -1000, -1000, 688, 1375, -1000,
-	-1000, 1363, -1000, -1000, 1191, -1000, 1159, 1024, 13503, 35,
-	35, 13503, 13503, 13503, 1357, 232, -1000, 13503, 1608, 794,
-	-1000, -1000, -1000, -1000, 681, -1000, 679, -1000, 180, -106,
-	-107, -1000, 1684, -101, 1681, 1671, 18211, 807, -1000, 82,
-	-1000, -1000, -1000, 385, 385, -1000, -1000, -1000, -1000, 874,
+	206, 5700, -1000, -1000, -1000, -1000, -1000, -1000, 13503, -1000,
+	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 784,
+	-1000, -1000, -1000, 888, 714, 1236, -1000, -1000, -1000, 780,
+	-1000, 772, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
+	768, -1000, -1000, 766, -1000, -1000, -1000, -1000, 1189, -1000,
+	714, -1000, -1000, -1000, 5700, -1000, -1000, -1000, -1000, -1000,
+	-1000, -1000, -121, -293, 765, -1000, 879, -89, -1000, -1000,
+	1700, 173, 19624, -1000, 469, 469, 586, 469, 469, 469,
+	469, 112, 104, 469, 469, 469, 469, 469, 469, 469,
+	469, 469, 469, 469, 469, 469, 469, 1421, -1000, -1000,
+	960, -1000, -1000, 627, 6576, -1000, -1000, 876, 741, 400,
+	405, 1420, -1000, 79, 601, 581, -1000, 18211, -1000, -38,
+	-1000, -1000, -1000, -1000, -1000, -1000, -1000, 874, 874, -1000,
+	-1000, 763, -1000, -1000, 1402, 1431, 50, 1401, -1000, 1396,
+	1395, 18211, 1104, 1253, -1000, 1388, 5700, 23, -1000, -1000,
+	993, 986, 1240, 1238, -1000, 1073, -100, -103, -1000, 1385,
+	-1000, -1000, 1747, 169, -1000, 1745, 19736, -1000, 755, 754,
+	469, 469, 749, 873, 872, 863, 469, 469, 747, 844,
+	18993, 743, 740, 738, 732, 843, 395, 698, 679, 671,
+	18211, 1384, 824, -1000, -1000, 1626, -1000, -1000, -1000, -1000,
+	-1000, -1000, -1000, -1000, -1000, -1000, -1000, 695, 1383, -1000,
+	-1000, 1382, -1000, -1000, 1220, -1000, 1210, 984, 13503, 68,
+	68, 13503, 13503, 13503, 1378, 241, -1000, 13503, 1672, 967,
+	-1000, -1000, -1000, -1000, 686, -1000, 685, -1000, 214, -97,
+	-103, -1000, 1744, -92, 1743, 1741, 18211, 673, -1000, 96,
+	-1000, -1000, -1000, 728, 728, -1000, -1000, -1000, -1000, 841,
 	827, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
 	-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-	-1000, -1000, -1000, 104, 18211, 1156, -1000, 399, 1016, 5700,
-	-234, 13503, -1000, 825, -1000, -1000, 1142, -1000, -1000, -1000,
-	-1000, -1000, -1000, -1000, 1137, 1133, 1131, 13503, -1000, -1000,
-	-1000, 64, 109, -1000, -1000, 1608, 901, 828, 1349, 674,
-	-96, 1661, -1000, 807, 1659, 807, 807, 1089, -1000, -1000,
-	43, 156, 146, -1000, 214, -1000, -1000, -1000, -1000, -1000,
-	-1000, 119, 1080, -1000, 822, 819, -1000, 714, 1538, -1000,
-	-27, 1069, -1000, -1000, -1000, -1000, -1000, 1055, -1000, -1000,
-	397, 818, 26, -1000, -1000, -1000, -1000, -1000, 1595, 11791,
-	-116, -1000, 808, -1000, 807, -1000, -1000, -1000, 18211, 40,
-	670, 6576, 1343, 6576, 1340, 54, 1336, -1000, -1000, -1000,
-	-1000, -1000, 232, -1000, -1000, 1537, 1472, 1726, -1000, -1000,
-	-1000, -1000, 109, 109, 109, 109, -25, 668, -1000, 885,
-	-1000, 18211, -1000, 1053, -1000, -1000, -1000, 312, -1000, -1000,
-	-1000, -1000, 1331, 1657, -1000, 1662, 18211, 1601, 18211, 1323,
-	396, 6576, -1000, -1000, 1731, -1000, 1721, 598, 598, -1000,
-	-1000, -1000, 1232, -1000, 393, -1000, 13075, 18211, -1000, 135,
-	51, -1000, 1044, -1000, 1042, 18211, 655, 1117, -1000, -1000,
-	-1000, 742, 67, -1000, 18211, 3942, -1000, 310, 1040, -1000,
-	931, 36, -1000, -1000, 998, -1000, -1000, -1000, -1000, -1000,
-	-1000, -1000, 606, 18211, -1000, 135, 1589, -1000, 641, -1000,
-	-1000, -1000, 19603, 131, -1000, -1000, 19603, 39, -1000, 114,
-	-1000, -1000, 994, -1000, 875, 1260, -1000, 39, 19736, 5700,
-	-1000, 19736, 968, -1000,
+	-1000, -1000, -1000, 125, 18211, 1197, -1000, 471, 976, 5700,
+	-227, 13503, -1000, 825, -1000, -1000, 1195, -1000, -1000, -1000,
+	-1000, -1000, -1000, -1000, 1184, 1159, 1156, 13503, -1000, -1000,
+	-1000, 74, 103, -1000, -1000, 1672, 973, 971, 1372, 682,
+	-86, 1739, -1000, 673, 1738, 673, 673, 1150, -1000, -1000,
+	61, 170, 145, -1000, 238, -1000, -1000, -1000, -1000, -1000,
+	-1000, 131, 1142, -1000, 824, 822, -1000, 939, 1555, -1000,
+	-15, 1137, -1000, -1000, -1000, -1000, -1000, 1134, -1000, -1000,
+	469, 774, 43, -1000, -1000, -1000, -1000, -1000, 1634, 11791,
+	-102, -1000, 746, -1000, 673, -1000, -1000, -1000, 18211, 57,
+	681, 6576, 1364, 6576, 1358, 69, 1352, -1000, -1000, -1000,
+	-1000, -1000, 241, -1000, -1000, 1553, 1519, 1766, -1000, -1000,
+	-1000, -1000, 103, 103, 103, 103, -9, 648, -1000, 885,
+	-1000, 18211, -1000, 1132, -1000, -1000, -1000, 348, -1000, -1000,
+	-1000, -1000, 1349, 1737, -1000, 1117, 18211, 787, 18211, 1347,
+	453, 6576, -1000, -1000, 1775, -1000, 1773, 434, 434, -1000,
+	-1000, -1000, 1191, -1000, 440, -1000, 13075, 18211, -1000, 162,
+	63, -1000, 1121, -1000, 1083, 18211, 644, 664, -1000, -1000,
+	-1000, 669, 83, -1000, 18211, 3942, -1000, 347, 1075, -1000,
+	963, 55, -1000, -1000, 1058, -1000, -1000, -1000, -1000, -1000,
+	-1000, -1000, 714, 18211, -1000, 162, 1376, -1000, 641, -1000,
+	-1000, -1000, 19603, 157, -1000, -1000, 19603, 51, -1000, 153,
+	-1000, -1000, 998, -1000, 942, 1346, -1000, 51, 19736, 5700,
+	-1000, 19736, 983, -1000,
 }
 
 var yyPgo = [...]int{
-	0, 100, 2119, 2116, 109, 107, 2115, 2113, 2112, 2111,
+	0, 100, 2119, 2116, 110, 108, 2115, 2113, 2112, 2111,
 	2110, 2105, 2104, 2103, 2101, 2098, 2096, 2095, 2094, 2092,
-	2091, 2090, 2088, 2087, 2086, 2083, 2082, 2080, 2065, 2063,
-	2062, 2061, 2060, 105, 2059, 2058, 2057, 2056, 2055, 2054,
-	130, 2052, 2051, 2044, 2043, 2042, 2041, 2039, 2037, 2036,
-	124, 46, 101, 721, 66, 185, 163, 122, 2035, 85,
-	170, 2034, 2033, 28, 116, 2032, 123, 121, 87, 145,
-	91, 86, 57, 2031, 2030, 2029, 135, 2026, 2025, 2024,
-	2023, 53, 2022, 72, 35, 29, 2021, 77, 2020, 2015,
-	2013, 2012, 2011, 75, 2010, 64, 43, 2008, 2007, 2006,
-	1992, 1991, 32, 1989, 45, 1988, 1987, 1986, 1985, 1983,
-	1982, 1981, 15, 17, 19, 1980, 1979, 16, 3, 1977,
-	138, 80, 76, 94, 1976, 180, 1975, 1974, 1972, 148,
-	1971, 117, 1970, 1969, 1968, 1967, 9, 1966, 42, 1965,
-	1964, 1963, 44, 1961, 1960, 1959, 89, 36, 71, 88,
-	1958, 1954, 1939, 137, 20, 54, 0, 131, 39, 1938,
-	128, 134, 1937, 84, 194, 133, 48, 1936, 38, 62,
-	1935, 1934, 1933, 98, 61, 12, 1932, 82, 1930, 90,
-	78, 1929, 97, 1926, 119, 2, 96, 1922, 139, 1916,
-	1915, 1914, 115, 1911, 1910, 55, 113, 1909, 1908, 1906,
-	31, 1905, 33, 21, 1904, 129, 146, 1903, 1902, 1901,
-	120, 95, 74, 1899, 1897, 65, 1896, 112, 68, 125,
-	1895, 728, 1891, 111, 63, 18, 1888, 140, 1886, 244,
-	156, 126, 1885, 1884, 149, 1601, 143, 1883, 155, 10,
-	1882, 1881, 11, 1879, 25, 1878, 1877, 1876, 1875, 6,
-	1874, 1873, 1872, 1, 5, 1870, 4, 114, 1869, 51,
-	56, 1868, 1866, 58, 1865, 1864, 1863, 1862, 1860, 162,
-	1859, 1845, 1844, 1843, 1842, 1839, 1818, 81, 1813, 1811,
-	1810, 1808, 60, 1807, 1806, 1805, 1804, 1803, 30, 1802,
-	1800, 22, 1798, 26, 1797, 1796, 1795, 13, 1794, 1793,
-	14, 1792, 1790, 7, 8, 1789, 1761, 52, 34, 37,
-	70, 69, 1760, 23, 1759, 92, 1757, 1756, 102, 1755,
-	99, 1754, 1753, 144, 161, 1752, 136, 1751, 1750, 1749,
-	1748, 1747, 1745, 1744, 1743, 1741, 132, 1737,
-}
-
-//line mysql_sql.y:6495
+	2091, 2090, 2088, 2087, 2086, 2083, 2082, 2080, 2079, 2078,
+	2077, 2076, 2075, 106, 2074, 2073, 2072, 2071, 2070, 2069,
+	137, 2068, 2065, 2063, 2062, 2061, 2060, 2059, 2058, 2057,
+	126, 46, 120, 714, 66, 185, 163, 122, 2056, 85,
+	154, 2055, 2054, 28, 116, 2052, 123, 119, 88, 145,
+	101, 87, 57, 2051, 2044, 2043, 134, 2042, 2041, 2039,
+	2037, 60, 2036, 75, 35, 29, 2035, 78, 2034, 2033,
+	2032, 2031, 2030, 74, 2029, 64, 43, 2026, 2025, 2024,
+	2023, 2022, 32, 2021, 45, 2020, 2015, 2013, 2012, 2011,
+	2010, 2008, 15, 17, 19, 2007, 2006, 16, 3, 1992,
+	143, 80, 77, 96, 1991, 188, 1989, 1988, 1987, 152,
+	1986, 117, 1985, 1983, 1982, 1981, 9, 1980, 42, 1979,
+	1977, 1976, 44, 1975, 1974, 1972, 91, 36, 71, 89,
+	1971, 1970, 1969, 135, 20, 54, 0, 136, 39, 1968,
+	133, 128, 1967, 86, 195, 130, 48, 1966, 38, 65,
+	1965, 1964, 1963, 98, 61, 12, 1961, 82, 1960, 90,
+	84, 1959, 97, 1958, 124, 2, 94, 1954, 140, 1939,
+	1938, 1937, 115, 1936, 1935, 55, 112, 1934, 1933, 1932,
+	31, 1930, 33, 21, 1929, 129, 148, 1926, 1922, 1916,
+	121, 105, 76, 1915, 1914, 68, 1911, 114, 69, 125,
+	1910, 718, 1909, 113, 63, 18, 1908, 146, 1906, 232,
+	156, 139, 1905, 1904, 151, 1600, 149, 1903, 131, 10,
+	1902, 1901, 11, 1899, 25, 1897, 1896, 1895, 1891, 6,
+	1888, 1886, 1885, 1, 5, 1884, 4, 99, 1883, 51,
+	56, 1882, 53, 58, 1881, 1879, 1876, 1875, 1870, 162,
+	1863, 1862, 1860, 1859, 1858, 1857, 1856, 81, 1855, 1854,
+	1853, 1852, 62, 1851, 1850, 1849, 1848, 1847, 30, 1845,
+	1844, 22, 1843, 26, 1842, 1839, 1818, 13, 1813, 1811,
+	14, 1810, 1808, 7, 8, 1807, 1806, 52, 34, 37,
+	72, 70, 1805, 23, 1804, 92, 1803, 1802, 102, 1801,
+	95, 1800, 1798, 144, 172, 1797, 138, 1796, 1795, 1794,
+	1793, 1792, 1790, 1789, 1786, 1785, 132, 1777,
+}
+
+//line mysql_sql.y:6500
 type yySymType struct {
 	union interface{}
 	id    int
@@ -4405,7 +4405,7 @@ var yyChk = [...]int{
 	-98, -96, 70, 81, 29, 313, -97, 64, 115, 243,
 	221, 244, -117, -167, 194, 76, 77, 301, -168, -265,
 	316, 315, -259, -260, -260, -259, -259, 54, 54, -259,
-	-262, 54, -259, -259, -307, -308, -156, -308, -156, -307,
+	-262, 54, -262, -259, -307, -308, -156, -308, -156, -307,
 	-307, -195, -179, -200, -202, -136, 54, 65, -273, -166,
 	65, 65, 65, 65, 56, -179, -287, -244, -139, 450,
 	65, 60, 340, 23, -240, 210, 55, -118, -148, -148,
@@ -4611,7 +4611,7 @@ var yyDef = [...]int{
 	0, 328, 0, 325, 0, 0, 0, 454, 347, -2,
 	0, -2, 1022, 963, 964, 965, 1009, 967, 1013, 1013,
 	1009, 1009, 995, 996, 997, 998, 999, 1000, 1001, 1002,
-	1003, 0, 0, 986, 1009, 1011, 1009, 1009, 1006, 968,
+	1003, 0, 0, 986, 1009, 1011, 1011, 1009, 1006, 968,
 	969, 970, 971, 972, 973, 974, 975, 976, 977, 978,
 	979, 980, 981, 637, 693, 659, 659, 648, 659, 659,
 	526, 0, 462, 463, 464, 465, 466, 474, 0, 532,
@@ -12564,7 +12564,7 @@ yydefault:
 						Family:             tree.TimestampFamily,
 						Precision:          yyDollar[2].lengthOptUnion(),
 						FamilyString:       yyDollar[1].str,
-						DisplayWith:        yyDollar[2].lengthOptUnion(),
+						DisplayWith:        26,
 						TimePrecisionIsSet: true,
 						Locale:             &locale,
 						Oid:                uint32(defines.MYSQL_TYPE_TIMESTAMP),
@@ -12579,23 +12579,28 @@ yydefault:
 //line mysql_sql.y:5741
 		{
 			locale := ""
-			yyLOCAL = &tree.T{
-				InternalType: tree.InternalType{
-					Family:             tree.TimestampFamily,
-					Precision:          0,
-					FamilyString:       yyDollar[1].str,
-					DisplayWith:        yyDollar[2].lengthOptUnion(),
-					TimePrecisionIsSet: false,
-					Locale:             &locale,
-					Oid:                uint32(defines.MYSQL_TYPE_DATETIME),
-				},
+			if yyDollar[2].lengthOptUnion() < 0 || yyDollar[2].lengthOptUnion() > 6 {
+				yylex.Error("For Datetime(fsp), fsp must in [0, 6]")
+				return 1
+			} else {
+				yyLOCAL = &tree.T{
+					InternalType: tree.InternalType{
+						Family:             tree.TimestampFamily,
+						Precision:          yyDollar[2].lengthOptUnion(),
+						FamilyString:       yyDollar[1].str,
+						DisplayWith:        26,
+						TimePrecisionIsSet: true,
+						Locale:             &locale,
+						Oid:                uint32(defines.MYSQL_TYPE_DATETIME),
+					},
+				}
 			}
 		}
 		yyVAL.union = yyLOCAL
 	case 990:
 		yyDollar = yyS[yypt-2 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5756
+//line mysql_sql.y:5761
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12613,7 +12618,7 @@ yydefault:
 	case 991:
 		yyDollar = yyS[yypt-2 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5772
+//line mysql_sql.y:5777
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12630,7 +12635,7 @@ yydefault:
 	case 992:
 		yyDollar = yyS[yypt-2 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5785
+//line mysql_sql.y:5790
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12647,7 +12652,7 @@ yydefault:
 	case 993:
 		yyDollar = yyS[yypt-2 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5798
+//line mysql_sql.y:5803
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12664,7 +12669,7 @@ yydefault:
 	case 994:
 		yyDollar = yyS[yypt-2 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5811
+//line mysql_sql.y:5816
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12681,7 +12686,7 @@ yydefault:
 	case 995:
 		yyDollar = yyS[yypt-1 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5824
+//line mysql_sql.y:5829
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12697,7 +12702,7 @@ yydefault:
 	case 996:
 		yyDollar = yyS[yypt-1 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5836
+//line mysql_sql.y:5841
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12713,7 +12718,7 @@ yydefault:
 	case 997:
 		yyDollar = yyS[yypt-1 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5848
+//line mysql_sql.y:5853
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12729,7 +12734,7 @@ yydefault:
 	case 998:
 		yyDollar = yyS[yypt-1 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5860
+//line mysql_sql.y:5865
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12745,7 +12750,7 @@ yydefault:
 	case 999:
 		yyDollar = yyS[yypt-1 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5872
+//line mysql_sql.y:5877
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12761,7 +12766,7 @@ yydefault:
 	case 1000:
 		yyDollar = yyS[yypt-1 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5884
+//line mysql_sql.y:5889
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12777,7 +12782,7 @@ yydefault:
 	case 1001:
 		yyDollar = yyS[yypt-1 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5896
+//line mysql_sql.y:5901
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12793,7 +12798,7 @@ yydefault:
 	case 1002:
 		yyDollar = yyS[yypt-1 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5908
+//line mysql_sql.y:5913
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12809,7 +12814,7 @@ yydefault:
 	case 1003:
 		yyDollar = yyS[yypt-1 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5920
+//line mysql_sql.y:5925
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12825,7 +12830,7 @@ yydefault:
 	case 1004:
 		yyDollar = yyS[yypt-4 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5932
+//line mysql_sql.y:5937
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12842,7 +12847,7 @@ yydefault:
 	case 1005:
 		yyDollar = yyS[yypt-4 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5945
+//line mysql_sql.y:5950
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12859,7 +12864,7 @@ yydefault:
 	case 1006:
 		yyDollar = yyS[yypt-1 : yypt+1]
 		var yyLOCAL *tree.T
-//line mysql_sql.y:5960
+//line mysql_sql.y:5965
 		{
 			locale := ""
 			yyLOCAL = &tree.T{
@@ -12875,7 +12880,7 @@ yydefault:
 	case 1007:
 		yyDollar = yyS[yypt-1 : yypt+1]
 		var yyLOCAL []string
-//line mysql_sql.y:5983
+//line mysql_sql.y:5988
 		{
 			yyLOCAL = make([]string, 0, 4)
 			yyLOCAL = append(yyLOCAL, yyDollar[1].str)
@@ -12884,7 +12889,7 @@ yydefault:
 	case 1008:
 		yyDollar = yyS[yypt-3 : yypt+1]
 		var yyLOCAL []string
-//line mysql_sql.y:5988
+//line mysql_sql.y:5993
 		{
 			yyLOCAL = append(yyDollar[1].strsUnion(), yyDollar[3].str)
 		}
@@ -12892,7 +12897,7 @@ yydefault:
 	case 1009:
 		yyDollar = yyS[yypt-0 : yypt+1]
 		var yyLOCAL int32
-//line mysql_sql.y:5994
+//line mysql_sql.y:5999
 		{
 			yyLOCAL = 0
 		}
@@ -12900,7 +12905,7 @@ yydefault:
 	case 1011:
 		yyDollar = yyS[yypt-0 : yypt+1]
 		var yyLOCAL int32
-//line mysql_sql.y:6001
+//line mysql_sql.y:6006
 		{
 			yyLOCAL = 6
 		}
@@ -12908,7 +12913,7 @@ yydefault:
 	case 1012:
 		yyDollar = yyS[yypt-3 : yypt+1]
 		var yyLOCAL int32
-//line mysql_sql.y:6005
+//line mysql_sql.y:6010
 		{
 			yyLOCAL = int32(yyDollar[2].item.(int64))
 		}
@@ -12916,7 +12921,7 @@ yydefault:
 	case 1013:
 		yyDollar = yyS[yypt-0 : yypt+1]
 		var yyLOCAL int32
-//line mysql_sql.y:6010
+//line mysql_sql.y:6015
 		{
 			yyLOCAL = int32(-1)
 		}
@@ -12924,7 +12929,7 @@ yydefault:
 	case 1014:
 		yyDollar = yyS[yypt-3 : yypt+1]
 		var yyLOCAL int32
-//line mysql_sql.y:6014
+//line mysql_sql.y:6019
 		{
 			yyLOCAL = int32(yyDollar[2].item.(int64))
 		}
@@ -12932,7 +12937,7 @@ yydefault:
 	case 1015:
 		yyDollar = yyS[yypt-3 : yypt+1]
 		var yyLOCAL int32
-//line mysql_sql.y:6020
+//line mysql_sql.y:6025
 		{
 			yyLOCAL = tree.GetDisplayWith(int32(yyDollar[2].item.(int64)))
 		}
@@ -12940,7 +12945,7 @@ yydefault:
 	case 1016:
 		yyDollar = yyS[yypt-0 : yypt+1]
 		var yyLOCAL tree.LengthScaleOpt
-//line mysql_sql.y:6026
+//line mysql_sql.y:6031
 		{
 			yyLOCAL = tree.LengthScaleOpt{
 				DisplayWith: tree.NotDefineDisplayWidth,
@@ -12951,7 +12956,7 @@ yydefault:
 	case 1017:
 		yyDollar = yyS[yypt-3 : yypt+1]
 		var yyLOCAL tree.LengthScaleOpt
-//line mysql_sql.y:6033
+//line mysql_sql.y:6038
 		{
 			yyLOCAL = tree.LengthScaleOpt{
 				DisplayWith: tree.GetDisplayWith(int32(yyDollar[2].item.(int64))),
@@ -12962,7 +12967,7 @@ yydefault:
 	case 1018:
 		yyDollar = yyS[yypt-5 : yypt+1]
 		var yyLOCAL tree.LengthScaleOpt
-//line mysql_sql.y:6040
+//line mysql_sql.y:6045
 		{
 			yyLOCAL = tree.LengthScaleOpt{
 				DisplayWith: tree.GetDisplayWith(int32(yyDollar[2].item.(int64))),
@@ -12973,7 +12978,7 @@ yydefault:
 	case 1019:
 		yyDollar = yyS[yypt-0 : yypt+1]
 		var yyLOCAL tree.LengthScaleOpt
-//line mysql_sql.y:6049
+//line mysql_sql.y:6054
 		{
 			yyLOCAL = tree.LengthScaleOpt{
 				DisplayWith: 10, // this is the default precision for decimal
@@ -12984,7 +12989,7 @@ yydefault:
 	case 1020:
 		yyDollar = yyS[yypt-3 : yypt+1]
 		var yyLOCAL tree.LengthScaleOpt
-//line mysql_sql.y:6056
+//line mysql_sql.y:6061
 		{
 			yyLOCAL = tree.LengthScaleOpt{
 				DisplayWith: tree.GetDisplayWith(int32(yyDollar[2].item.(int64))),
@@ -12995,7 +13000,7 @@ yydefault:
 	case 1021:
 		yyDollar = yyS[yypt-5 : yypt+1]
 		var yyLOCAL tree.LengthScaleOpt
-//line mysql_sql.y:6063
+//line mysql_sql.y:6068
 		{
 			yyLOCAL = tree.LengthScaleOpt{
 				DisplayWith: tree.GetDisplayWith(int32(yyDollar[2].item.(int64))),
@@ -13006,7 +13011,7 @@ yydefault:
 	case 1022:
 		yyDollar = yyS[yypt-0 : yypt+1]
 		var yyLOCAL bool
-//line mysql_sql.y:6072
+//line mysql_sql.y:6077
 		{
 			yyLOCAL = false
 		}
@@ -13014,7 +13019,7 @@ yydefault:
 	case 1023:
 		yyDollar = yyS[yypt-1 : yypt+1]
 		var yyLOCAL bool
-//line mysql_sql.y:6076
+//line mysql_sql.y:6081
 		{
 			yyLOCAL = true
 		}
@@ -13022,33 +13027,33 @@ yydefault:
 	case 1024:
 		yyDollar = yyS[yypt-1 : yypt+1]
 		var yyLOCAL bool
-//line mysql_sql.y:6080
+//line mysql_sql.y:6085
 		{
 			yyLOCAL = false
 		}
 		yyVAL.union = yyLOCAL
 	case 1025:
 		yyDollar = yyS[yypt-0 : yypt+1]
-//line mysql_sql.y:6086
+//line mysql_sql.y:6091
 		{
 		}
 	case 1026:
 		yyDollar = yyS[yypt-1 : yypt+1]
 		var yyLOCAL bool
-//line mysql_sql.y:6088
+//line mysql_sql.y:6093
 		{
 			yyLOCAL = true
 		}
 		yyVAL.union = yyLOCAL
 	case 1030:
 		yyDollar = yyS[yypt-0 : yypt+1]
-//line mysql_sql.y:6098
+//line mysql_sql.y:6103
 		{
 			yyVAL.str = ""
 		}
 	case 1031:
 		yyDollar = yyS[yypt-1 : yypt+1]
-//line mysql_sql.y:6102
+//line mysql_sql.y:6107
 		{
 			yyVAL.str = string(yyDollar[1].str)
 		}
diff --git a/pkg/sql/parsers/dialect/mysql/mysql_sql.y b/pkg/sql/parsers/dialect/mysql/mysql_sql.y
index 8f759b080..abb7fdf9c 100644
--- a/pkg/sql/parsers/dialect/mysql/mysql_sql.y
+++ b/pkg/sql/parsers/dialect/mysql/mysql_sql.y
@@ -5729,7 +5729,7 @@ time_type:
 		        Family:             tree.TimestampFamily,
 		        Precision:          $2,
                 	FamilyString: $1,
-                	DisplayWith: $2,
+                	DisplayWith: 26,
 		        TimePrecisionIsSet: true,
 		        Locale:             &locale,
 		        Oid:                uint32(defines.MYSQL_TYPE_TIMESTAMP),
@@ -5737,19 +5737,24 @@ time_type:
 	    }
         }
     }
-|   DATETIME length_opt
+|   DATETIME timestamp_option_opt
     {
         locale := ""
-        $$ = &tree.T{
-            InternalType: tree.InternalType{
+        if $2 < 0 || $2 > 6 {
+        		yylex.Error("For Datetime(fsp), fsp must in [0, 6]")
+        		return 1
+                } else {
+                $$ = &tree.T{
+            		InternalType: tree.InternalType{
 		        Family:             tree.TimestampFamily,
-		        Precision:          0,
-                FamilyString: $1,
-                DisplayWith: $2,
-		        TimePrecisionIsSet: false,
+		        Precision:          $2,
+                	FamilyString: $1,
+                	DisplayWith: 26,
+		        TimePrecisionIsSet: true,
 		        Locale:             &locale,
 		        Oid:                uint32(defines.MYSQL_TYPE_DATETIME),
 	        },
+	    }
         }
     }
 |   YEAR length_opt
diff --git a/pkg/sql/plan/constant.go b/pkg/sql/plan/constant.go
index 62fb00710..bee7a3dd9 100644
--- a/pkg/sql/plan/constant.go
+++ b/pkg/sql/plan/constant.go
@@ -606,7 +606,7 @@ func toDatetime(e *extend.ValueExtend) error {
 	vec.Ref = 1
 
 	if e.V.Typ.Oid == types.T_char || e.V.Typ.Oid == types.T_varchar {
-		d, err := types.ParseDatetime(string(e.V.Col.(*types.Bytes).Get(0)))
+		d, err := types.ParseDatetime(string(e.V.Col.(*types.Bytes).Get(0)), 6)
 		if err != nil {
 			return err
 		}
diff --git a/pkg/sql/plan/create_table.go b/pkg/sql/plan/create_table.go
index 37c0410de..a33e94b26 100644
--- a/pkg/sql/plan/create_table.go
+++ b/pkg/sql/plan/create_table.go
@@ -229,7 +229,7 @@ func (b *build) getTableDefType(typ tree.ResolvableTypeReference) (*types.Type,
 		case defines.MYSQL_TYPE_DATE:
 			return &types.Type{Oid: types.T_date, Size: 4}, nil
 		case defines.MYSQL_TYPE_DATETIME:
-			return &types.Type{Oid: types.T_datetime, Size: 8}, nil
+			return &types.Type{Oid: types.T_datetime, Size: 8, Precision: n.InternalType.Precision}, nil
 		case defines.MYSQL_TYPE_TIMESTAMP:
 			return &types.Type{Oid: types.T_timestamp, Size: 8, Precision: n.InternalType.Precision}, nil
 		case defines.MYSQL_TYPE_DECIMAL:
diff --git a/pkg/sql/plan/expr.go b/pkg/sql/plan/expr.go
index 70db59269..238301424 100644
--- a/pkg/sql/plan/expr.go
+++ b/pkg/sql/plan/expr.go
@@ -737,7 +737,7 @@ func buildConstantValue(typ types.Type, num *tree.NumVal) (interface{}, error) {
 			}
 		case types.T_datetime:
 			if !num.Negative() {
-				return types.ParseDatetime(str)
+				return types.ParseDatetime(str, typ.Precision)
 			}
 		}
 	case constant.Float:
@@ -791,7 +791,7 @@ func buildConstantValue(typ types.Type, num *tree.NumVal) (interface{}, error) {
 			}
 			return float64(v), nil
 		case types.T_datetime:
-			return types.ParseDatetime(str)
+			return types.ParseDatetime(str, typ.Precision)
 		case types.T_decimal64:
 			return types.ParseStringToDecimal64(str, typ.Width, typ.Scale)
 		case types.T_decimal128:
@@ -811,7 +811,7 @@ func buildConstantValue(typ types.Type, num *tree.NumVal) (interface{}, error) {
 			case types.T_date:
 				return types.ParseDate(constant.StringVal(val))
 			case types.T_datetime:
-				return types.ParseDatetime(constant.StringVal(val))
+				return types.ParseDatetime(constant.StringVal(val), typ.Precision)
 			case types.T_timestamp:
 				return types.ParseTimestamp(constant.StringVal(val), typ.Precision)
 			}
diff --git a/pkg/sql/plan/insert.go b/pkg/sql/plan/insert.go
index d73c6d021..bdd7745db 100644
--- a/pkg/sql/plan/insert.go
+++ b/pkg/sql/plan/insert.go
@@ -570,7 +570,7 @@ func makeExprFromVal(typ types.Type, value interface{}, isNull bool) tree.Expr {
 		res := value.(types.Date).String()
 		return tree.NewNumVal(constant.MakeString(res), res, false)
 	case types.T_datetime:
-		res := value.(types.Datetime).String()
+		res := value.(types.Datetime).String2(typ.Precision)
 		return tree.NewNumVal(constant.MakeString(res), res, false)
 	}
 	return tree.NewNumVal(constant.MakeUnknown(), "NULL", false)
diff --git a/pkg/sql/plan2/build_util.go b/pkg/sql/plan2/build_util.go
index e980a8204..ca79d21e0 100644
--- a/pkg/sql/plan2/build_util.go
+++ b/pkg/sql/plan2/build_util.go
@@ -964,7 +964,7 @@ func buildConstantValue(typ *plan.Type, num *tree.NumVal) (interface{}, error) {
 			}
 		case plan.Type_DATETIME:
 			if !num.Negative() {
-				return types.ParseDatetime(str)
+				return types.ParseDatetime(str, typ.Precision)
 			}
 		}
 	case constant.Float:
@@ -1018,7 +1018,7 @@ func buildConstantValue(typ *plan.Type, num *tree.NumVal) (interface{}, error) {
 			}
 			return float64(v), nil
 		case plan.Type_DATETIME:
-			return types.ParseDatetime(str)
+			return types.ParseDatetime(str, typ.Precision)
 		case plan.Type_DECIMAL64:
 			return types.ParseStringToDecimal64(str, typ.Width, typ.Scale)
 		case plan.Type_DECIMAL128:
@@ -1038,7 +1038,7 @@ func buildConstantValue(typ *plan.Type, num *tree.NumVal) (interface{}, error) {
 			case plan.Type_DATE:
 				return types.ParseDate(constant.StringVal(val))
 			case plan.Type_DATETIME:
-				return types.ParseDatetime(constant.StringVal(val))
+				return types.ParseDatetime(constant.StringVal(val), typ.Precision)
 			case plan.Type_TIMESTAMP:
 				return types.ParseTimestamp(constant.StringVal(val), typ.Precision)
 			}
diff --git a/pkg/sql/plan2/function/builtin/multi/unix_timestamp.go b/pkg/sql/plan2/function/builtin/multi/unix_timestamp.go
index 90a1df9ff..5d906c731 100644
--- a/pkg/sql/plan2/function/builtin/multi/unix_timestamp.go
+++ b/pkg/sql/plan2/function/builtin/multi/unix_timestamp.go
@@ -57,7 +57,7 @@ func UnixTimestampVarchar(lv []*vector.Vector, proc *process.Process) (*vector.V
 }
 
 func MustDatetimeMe(s string) types.Datetime {
-	datetime, err := types.ParseDatetime(s)
+	datetime, err := types.ParseDatetime(s, 6)
 	if err != nil {
 		panic("bad datetime")
 	}
diff --git a/pkg/sql/plan2/function/operator/cast.go b/pkg/sql/plan2/function/operator/cast.go
index 2aa8ada65..663be355c 100644
--- a/pkg/sql/plan2/function/operator/cast.go
+++ b/pkg/sql/plan2/function/operator/cast.go
@@ -752,7 +752,7 @@ func CastVarcharAsDatetime(lv, rv *vector.Vector, proc *process.Process) (*vecto
 		vec := proc.AllocScalarVector(rv.Typ)
 		rs := make([]types.Datetime, 1)
 		varcharValue := vs.Get(0)
-		data, err2 := types.ParseDatetime(string(varcharValue))
+		data, err2 := types.ParseDatetime(string(varcharValue), 6)
 		if err2 != nil {
 			return nil, err2
 		}
@@ -773,7 +773,7 @@ func CastVarcharAsDatetime(lv, rv *vector.Vector, proc *process.Process) (*vecto
 			continue
 		}
 		varcharValue := vs.Get(int64(i))
-		data, err2 := types.ParseDatetime(string(varcharValue))
+		data, err2 := types.ParseDatetime(string(varcharValue), 6)
 		if err2 != nil {
 			return nil, err2
 		}
diff --git a/pkg/vectorize/date_add/date_add.go b/pkg/vectorize/date_add/date_add.go
index ae5f277aa..3db173277 100644
--- a/pkg/vectorize/date_add/date_add.go
+++ b/pkg/vectorize/date_add/date_add.go
@@ -54,7 +54,7 @@ func dateStringAdd(xs *types.Bytes, ys []int64, zs []int64, ns *nulls.Nulls, rs
 				continue
 			}
 		}
-		d, e := types.ParseDatetime(str)
+		d, e := types.ParseDatetime(str, 0)
 		if e != nil {
 			// set null
 			nulls.Add(ns, uint64(i))
diff --git a/pkg/vectorize/date_sub/date_sub.go b/pkg/vectorize/date_sub/date_sub.go
index 445c3d8d0..3cd36be64 100644
--- a/pkg/vectorize/date_sub/date_sub.go
+++ b/pkg/vectorize/date_sub/date_sub.go
@@ -54,7 +54,7 @@ func dateStringSub(xs *types.Bytes, ys []int64, zs []int64, ns *nulls.Nulls, rs
 				continue
 			}
 		}
-		d, e := types.ParseDatetime(str)
+		d, e := types.ParseDatetime(str, 0)
 		if e != nil {
 			// set null
 			nulls.Add(ns, uint64(i))
diff --git a/pkg/vectorize/month/month.go b/pkg/vectorize/month/month.go
index 628df58a3..c16f512b3 100644
--- a/pkg/vectorize/month/month.go
+++ b/pkg/vectorize/month/month.go
@@ -48,7 +48,7 @@ func datetimeToMonth(xs []types.Datetime, rs []uint8) []uint8 {
 func dateStringToMonth(xs *types.Bytes, ns *nulls.Nulls, rs []uint8) []uint8 {
 	for i := range xs.Lengths {
 		str := string(xs.Get(int64(i)))
-		d, e := types.ParseDatetime(str)
+		d, e := types.ParseDatetime(str, 0)
 		if e != nil {
 			// set null
 			nulls.Add(ns, uint64(i))
diff --git a/pkg/vectorize/year/year.go b/pkg/vectorize/year/year.go
index 84311f029..a74b7ca6e 100644
--- a/pkg/vectorize/year/year.go
+++ b/pkg/vectorize/year/year.go
@@ -49,7 +49,7 @@ func datetimeToYear(xs []types.Datetime, rs []uint16) []uint16 {
 func dateStringToYear(xs *types.Bytes, ns *nulls.Nulls, rs []uint16) []uint16 {
 	for i := range xs.Lengths {
 		str := string(xs.Get(int64(i)))
-		d, e := types.ParseDatetime(str)
+		d, e := types.ParseDatetime(str, 0)
 		if e != nil {
 			// set null
 			nulls.Add(ns, uint64(i))
diff --git a/pkg/vm/engine/tae/moengine/reader.go b/pkg/vm/engine/tae/moengine/reader.go
index a6e0710b9..80dce2135 100644
--- a/pkg/vm/engine/tae/moengine/reader.go
+++ b/pkg/vm/engine/tae/moengine/reader.go
@@ -20,7 +20,6 @@ import (
 	"github.com/matrixorigin/matrixone/pkg/container/vector"
 	"github.com/matrixorigin/matrixone/pkg/logutil"
 	"github.com/matrixorigin/matrixone/pkg/vm/engine"
-	"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/catalog"
 	"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/iface/handle"
 	"time"
 )
@@ -30,18 +29,9 @@ var (
 )
 
 func newReader(rel handle.Relation, it handle.BlockIt) *txnReader {
-	attrCnt := len(rel.GetMeta().(*catalog.TableEntry).GetSchema().ColDefs)
-	cds := make([]*bytes.Buffer, attrCnt)
-	dds := make([]*bytes.Buffer, attrCnt)
-	for i := 0; i < attrCnt; i++ {
-		cds[i] = bytes.NewBuffer(make([]byte, 1<<20))
-		dds[i] = bytes.NewBuffer(make([]byte, 1<<20))
-	}
 	return &txnReader{
-		compressed:   cds,
-		decompressed: dds,
-		handle:       rel,
-		it:           it,
+		handle: rel,
+		it:     it,
 	}
 }
 
@@ -53,6 +43,16 @@ func (r *txnReader) Read(refCount []uint64, attrs []string) (*batch.Batch, error
 			r, r.latency)
 		return nil, nil
 	}
+	if r.compressed == nil {
+		r.compressed = make([]*bytes.Buffer, len(attrs))
+		r.decompressed = make([]*bytes.Buffer, len(attrs))
+		for i := 0; i < len(attrs); i++ {
+			//cds[i] = bytes.NewBuffer(make([]byte, 1<<20))
+			//dds[i] = bytes.NewBuffer(make([]byte, 1<<20))
+			r.compressed[i] = new(bytes.Buffer)
+			r.decompressed[i] = new(bytes.Buffer)
+		}
+	}
 	h := r.it.GetBlock()
 	r.it.Next()
 	r.it.Unlock()
diff --git a/proto/metadata.proto b/proto/metadata.proto
index ae6a01b14..1f0ef4424 100644
--- a/proto/metadata.proto
+++ b/proto/metadata.proto
@@ -17,20 +17,40 @@ option go_package = "github.com/matrixorigin/matrixone/pkg/pb/metadata";
 
 import "github.com/gogo/protobuf/gogoproto/gogo.proto";
 
-// DN dn shard metadata
-message DN {
-    // ID the id of the DN. The ID is not modified after the DN is created.
-    uint64 id         = 1 [(gogoproto.customname) = "ID"];
-    // ReplicaID only one replica for one DN. The ReplicaID is specified at
-    // the time the DN is created. DN restart ReplicaID will not change, when 
-    // a DN is migrated to another node, the ReplicaID will be reset.
-    uint64 replicaID  = 2;
-    // LogShardID a DN corresponds to a unique Shard of LogService.
-    uint64 logShardID = 3;
-    // Start A DN manages data within a range [Start, end)
-    bytes  start      = 4;
-    // End A DN manages data within a range [Start, end)
-    bytes  end        = 5;
-    // Address DN external service address.
-    string address    = 6;
-}
+// DNShardRecord is DN shard metadata describing what is a DN shard. It
+// is internally used by HAKeeper to maintain how many DNs available in
+// the system. 
+message DNShardRecord {
+  // ShardID the id of the DN shard.
+  uint64 ShardID    = 1;
+  // LogShardID a DN corresponds to a unique Shard of LogService.
+  uint64 LogShardID = 2;
+  // Start A DN manages data within a range [Start, end)
+  bytes  Start      = 3;
+  // End A DN manages data within a range [Start, end)
+  bytes  End        = 4;
+};
+
+// DNShard 
+message DNShard {
+  // DNShard extends DNShardRecord
+  DNShardRecord DNShardRecord = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true];
+  // ReplicaID only one replica for one DN. The ReplicaID is specified at
+  // the time the DN is created. DN restart ReplicaID will not change, when
+  // a DN is migrated to another node, the ReplicaID will be reset.
+  uint64 ReplicaID  = 2;
+  // Address is DN's external service address.
+  string Address    = 3;
+};
+
+// LogShardRecord is Log Shard Metadata describing what is a Log shard. It is
+// internally used by the HAKeeper to maintain how many Log shards are available
+// in the system.
+message LogShardRecord {
+  // ShardID is the id of the Log Shard. 
+  uint64 ShardID = 1;
+  // NumberOfReplicas is the number of replicas in the shard.
+  uint64 NumberOfReplicas = 2;
+  // Name is the human readable name of the shard given by the DN.
+  string Name = 3;
+};


Test patch:
diff --git a/pkg/container/types/datetime_test.go b/pkg/container/types/datetime_test.go
index f05387f52..6ce9f56f8 100644
--- a/pkg/container/types/datetime_test.go
+++ b/pkg/container/types/datetime_test.go
@@ -77,43 +77,43 @@ func TestAddDatetime(t *testing.T) {
 	}{
 		{"2022-01-31 00:00:00", "1", MicroSecond, "2022-01-31 00:00:00.000001"},
 		{"2022-01-31 00:00:00.000001", "1", MicroSecond, "2022-01-31 00:00:00.000002"},
-		{"2022-01-31 00:00:00", "1", Second, "2022-01-31 00:00:01"},
-		{"2022-01-31 00:00:00", "1", Minute, "2022-01-31 00:01:00"},
-		{"2022-01-31 00:00:00", "1", Hour, "2022-01-31 01:00:00"},
-		{"2022-01-31 00:00:00", "1", Day, "2022-02-01 00:00:00"},
-		{"2022-01-31 00:00:00", "1", Week, "2022-02-07 00:00:00"},
-		{"2022-01-01 00:00:00", "1", Month, "2022-02-01 00:00:00"},
-		{"2022-01-31 00:00:00", "1", Month, "2022-02-28 00:00:00"},
-		{"2022-01-01 00:00:00", "1", Quarter, "2022-04-01 00:00:00"},
-		{"2022-01-31 00:00:00", "1", Quarter, "2022-04-30 00:00:00"},
-		{"2022-01-01 00:00:00", "1", Year, "2023-01-01 00:00:00"},
-		{"2020-02-29 00:00:00", "1", Year, "2021-02-28 00:00:00"},
+		{"2022-01-31 00:00:00", "1", Second, "2022-01-31 00:00:01.000000"},
+		{"2022-01-31 00:00:00", "1", Minute, "2022-01-31 00:01:00.000000"},
+		{"2022-01-31 00:00:00", "1", Hour, "2022-01-31 01:00:00.000000"},
+		{"2022-01-31 00:00:00", "1", Day, "2022-02-01 00:00:00.000000"},
+		{"2022-01-31 00:00:00", "1", Week, "2022-02-07 00:00:00.000000"},
+		{"2022-01-01 00:00:00", "1", Month, "2022-02-01 00:00:00.000000"},
+		{"2022-01-31 00:00:00", "1", Month, "2022-02-28 00:00:00.000000"},
+		{"2022-01-01 00:00:00", "1", Quarter, "2022-04-01 00:00:00.000000"},
+		{"2022-01-31 00:00:00", "1", Quarter, "2022-04-30 00:00:00.000000"},
+		{"2022-01-01 00:00:00", "1", Year, "2023-01-01 00:00:00.000000"},
+		{"2020-02-29 00:00:00", "1", Year, "2021-02-28 00:00:00.000000"},
 
 		{"2022-01-01 00:00:00", "1.1", Second_MicroSecond, "2022-01-01 00:00:01.100000"},
 		{"2022-01-01 00:00:00", "1:1.1", Minute_MicroSecond, "2022-01-01 00:01:01.100000"},
-		{"2022-01-01 00:00:00", "1:1", Minute_Second, "2022-01-01 00:01:01"},
+		{"2022-01-01 00:00:00", "1:1", Minute_Second, "2022-01-01 00:01:01.000000"},
 		{"2022-01-01 00:00:00", "1:1:1.1", Hour_MicroSecond, "2022-01-01 01:01:01.100000"},
-		{"2022-01-01 00:00:00", "1:1:1", Hour_Second, "2022-01-01 01:01:01"},
-		{"2022-01-01 00:00:00", "1:1", Hour_Minute, "2022-01-01 01:01:00"},
+		{"2022-01-01 00:00:00", "1:1:1", Hour_Second, "2022-01-01 01:01:01.000000"},
+		{"2022-01-01 00:00:00", "1:1", Hour_Minute, "2022-01-01 01:01:00.000000"},
 		{"2022-01-01 00:00:00", "1 1:1:1.1", Day_MicroSecond, "2022-01-02 01:01:01.100000"},
-		{"2022-01-01 00:00:00", "1 1:1:1", Day_Second, "2022-01-02 01:01:01"},
-		{"2022-01-01 00:00:00", "1 1:1", Day_Minute, "2022-01-02 01:01:00"},
-		{"2022-01-01 00:00:00", "1 1", Day_Hour, "2022-01-02 01:00:00"},
-		{"2022-01-01 00:00:00", "1-1", Year_Month, "2023-02-01 00:00:00"},
+		{"2022-01-01 00:00:00", "1 1:1:1", Day_Second, "2022-01-02 01:01:01.000000"},
+		{"2022-01-01 00:00:00", "1 1:1", Day_Minute, "2022-01-02 01:01:00.000000"},
+		{"2022-01-01 00:00:00", "1 1", Day_Hour, "2022-01-02 01:00:00.000000"},
+		{"2022-01-01 00:00:00", "1-1", Year_Month, "2023-02-01 00:00:00.000000"},
 
-		{"2022-01-31 00:00:00", "1-1", Year_Month, "2023-02-28 00:00:00"},
+		{"2022-01-31 00:00:00", "1-1", Year_Month, "2023-02-28 00:00:00.000000"},
 
-		{"2020-12-31 23:59:59", "1", Second, "2021-01-01 00:00:00"},
-		{"2100-12-31 23:59:59", "1:1", Minute_Second, "2101-01-01 00:01:00"},
+		{"2020-12-31 23:59:59", "1", Second, "2021-01-01 00:00:00.000000"},
+		{"2100-12-31 23:59:59", "1:1", Minute_Second, "2101-01-01 00:01:00.000000"},
 		{"1992-12-31 23:59:59.000002", "1.999999", Second_MicroSecond, "1993-01-01 00:00:01.000001"},
 		{"1992-12-31 23:59:59.1", "1.1", Second_MicroSecond, "1993-01-01 00:00:00.200000"},
 	}
 	for _, test := range addDateTimeTbl {
 		ret, rettype, _ := NormalizeInterval(test.InputIntervalNum, test.InputIntervalTypes)
-		d, err := ParseDatetime(test.Input)
+		d, err := ParseDatetime(test.Input, 6)
 		require.Equal(t, err, nil)
 		d = d.AddInterval(ret, rettype)
-		require.Equal(t, d.String(), test.expect)
+		require.Equal(t, test.expect, d.String2(6))
 	}
 }
 
@@ -125,38 +125,38 @@ func TestSubDateTime(t *testing.T) {
 		expect             string
 	}{
 		{"2022-01-31 00:00:00", "1", MicroSecond, "2022-01-30 23:59:59.999999"},
-		{"2022-01-31 00:00:00.000001", "1", MicroSecond, "2022-01-31 00:00:00"},
-		{"2022-01-31 00:00:00", "1", Second, "2022-01-30 23:59:59"},
-		{"2022-01-31 00:00:00", "1", Minute, "2022-01-30 23:59:00"},
-		{"2022-01-31 00:00:00", "1", Hour, "2022-01-30 23:00:00"},
-		{"2022-01-31 00:00:00", "1", Day, "2022-01-30 00:00:00"},
-		{"2022-01-31 00:00:00", "1", Week, "2022-01-24 00:00:00"},
-		{"2022-01-01 00:00:00", "1", Month, "2021-12-01 00:00:00"},
-		{"2022-03-31 00:00:00", "1", Month, "2022-02-28 00:00:00"},
-		{"2022-01-01 00:00:00", "1", Quarter, "2021-10-01 00:00:00"},
-		{"2022-01-31 00:00:00", "1", Quarter, "2021-10-31 00:00:00"},
-		{"2022-01-01 00:00:00", "1", Year, "2021-01-01 00:00:00"},
-		{"2020-02-29 00:00:00", "1", Year, "2019-02-28 00:00:00"},
+		{"2022-01-31 00:00:00.000001", "1", MicroSecond, "2022-01-31 00:00:00.000000"},
+		{"2022-01-31 00:00:00", "1", Second, "2022-01-30 23:59:59.000000"},
+		{"2022-01-31 00:00:00", "1", Minute, "2022-01-30 23:59:00.000000"},
+		{"2022-01-31 00:00:00", "1", Hour, "2022-01-30 23:00:00.000000"},
+		{"2022-01-31 00:00:00", "1", Day, "2022-01-30 00:00:00.000000"},
+		{"2022-01-31 00:00:00", "1", Week, "2022-01-24 00:00:00.000000"},
+		{"2022-01-01 00:00:00", "1", Month, "2021-12-01 00:00:00.000000"},
+		{"2022-03-31 00:00:00", "1", Month, "2022-02-28 00:00:00.000000"},
+		{"2022-01-01 00:00:00", "1", Quarter, "2021-10-01 00:00:00.000000"},
+		{"2022-01-31 00:00:00", "1", Quarter, "2021-10-31 00:00:00.000000"},
+		{"2022-01-01 00:00:00", "1", Year, "2021-01-01 00:00:00.000000"},
+		{"2020-02-29 00:00:00", "1", Year, "2019-02-28 00:00:00.000000"},
 
 		{"2022-01-01 00:00:00", "1.1", Second_MicroSecond, "2021-12-31 23:59:58.900000"},
 		{"2022-01-01 00:00:00", "1:1.1", Minute_MicroSecond, "2021-12-31 23:58:58.900000"},
-		{"2022-01-01 00:00:00", "1:1", Minute_Second, "2021-12-31 23:58:59"},
+		{"2022-01-01 00:00:00", "1:1", Minute_Second, "2021-12-31 23:58:59.000000"},
 		{"2022-01-01 00:00:00", "1:1:1.1", Hour_MicroSecond, "2021-12-31 22:58:58.900000"},
-		{"2022-01-01 00:00:00", "1:1:1", Hour_Second, "2021-12-31 22:58:59"},
-		{"2022-01-01 00:00:00", "1:1", Hour_Minute, "2021-12-31 22:59:00"},
+		{"2022-01-01 00:00:00", "1:1:1", Hour_Second, "2021-12-31 22:58:59.000000"},
+		{"2022-01-01 00:00:00", "1:1", Hour_Minute, "2021-12-31 22:59:00.000000"},
 		{"2022-01-01 00:00:00", "1 1:1:1.1", Day_MicroSecond, "2021-12-30 22:58:58.900000"},
-		{"2022-01-01 00:00:00", "1 1:1:1", Day_Second, "2021-12-30 22:58:59"},
-		{"2022-01-01 00:00:00", "1 1:1", Day_Minute, "2021-12-30 22:59:00"},
-		{"2022-01-01 00:00:00", "1 1", Day_Hour, "2021-12-30 23:00:00"},
-		{"2022-01-01 00:00:00", "1-1", Year_Month, "2020-12-01 00:00:00"},
+		{"2022-01-01 00:00:00", "1 1:1:1", Day_Second, "2021-12-30 22:58:59.000000"},
+		{"2022-01-01 00:00:00", "1 1:1", Day_Minute, "2021-12-30 22:59:00.000000"},
+		{"2022-01-01 00:00:00", "1 1", Day_Hour, "2021-12-30 23:00:00.000000"},
+		{"2022-01-01 00:00:00", "1-1", Year_Month, "2020-12-01 00:00:00.000000"},
 		{"2022-01-31 00:00:00.1", "1", Second, "2022-01-30 23:59:59.100000"},
 	}
 	for _, test := range subDateTimeTbl {
 		ret, rettype, _ := NormalizeInterval(test.InputIntervalNum, test.InputIntervalTypes)
-		d, err := ParseDatetime(test.Input)
+		d, err := ParseDatetime(test.Input, 6)
 		require.Equal(t, err, nil)
 		d = d.AddInterval(-ret, rettype)
-		require.Equal(t, d.String(), test.expect)
+		require.Equal(t, test.expect, d.String2(6))
 	}
 }
 
@@ -170,8 +170,8 @@ func TestParseDatetime(t *testing.T) {
 		// 1. yyyy-mm-dd hh:mm:ss(.msec)
 		{
 			name: "yyyy-mm-dd hh:mm:ss",
-			args: "1987-08-25 00:00:00",
-			want: "1987-08-25 00:00:00",
+			args: "1987-08-25 00:00:00.000000",
+			want: "1987-08-25 00:00:00.000000",
 		},
 		{
 			name: "yyyy-mm-dd hh:mm:ss.sec",
@@ -182,7 +182,7 @@ func TestParseDatetime(t *testing.T) {
 		{
 			name: "yyyymmddhhmmss",
 			args: "19870825000000",
-			want: "1987-08-25 00:00:00",
+			want: "1987-08-25 00:00:00.000000",
 		},
 		{
 			name: "yyyymmddhhmmss.sec",
@@ -224,7 +224,7 @@ func TestParseDatetime(t *testing.T) {
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
-			got, err := ParseDatetime(tt.args)
+			got, err := ParseDatetime(tt.args, 6)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("ParseDatetime() error = %v, wantErr %v", err, tt.wantErr)
 				return
@@ -232,15 +232,15 @@ func TestParseDatetime(t *testing.T) {
 			if err != nil && tt.wantErr {
 				return
 			}
-			if got.String() != tt.want {
-				t.Errorf("ParseDatetime() got = %v, want %v", got, tt.want)
+			if got.String2(6) != tt.want {
+				t.Errorf("ParseDatetime() got = %v, want %v", got.String2(6), tt.want)
 			}
 		})
 	}
 }
 
 func TestUTC(t *testing.T) {
-	args, _ := ParseDatetime("1987-08-25 00:00:00")
+	args, _ := ParseDatetime("1987-08-25 00:00:00", 6)
 	utc := args.UTC()
 	_, offset := time.Now().Local().Zone()
 	if args.sec()-utc.sec() != localTZ {
@@ -258,7 +258,7 @@ func TestUnix(t *testing.T) {
 	}
 
 	for _, c := range cases {
-		time, _ := ParseDatetime(c.time)
+		time, _ := ParseDatetime(c.time, 6)
 		unix_time := time.UnixTimestamp()
 		if unix_time != c.timestamp {
 			t.Errorf("UnixTimestamp want %d but got %d ", c.timestamp, unix_time)
diff --git a/pkg/frontend/mysql_protocol_test.go b/pkg/frontend/mysql_protocol_test.go
index 5455782dc..6b8fb878d 100644
--- a/pkg/frontend/mysql_protocol_test.go
+++ b/pkg/frontend/mysql_protocol_test.go
@@ -765,9 +765,9 @@ func makeMysqlDatetimeResultSet() *MysqlResultSet {
 
 	rs.AddColumn(mysqlCol)
 
-	d1, _ := types.ParseDatetime("2018-04-28 10:21:15")
-	d2, _ := types.ParseDatetime("2018-04-28 10:21:15.123")
-	d3, _ := types.ParseDatetime("2015-03-03 12:12:12")
+	d1, _ := types.ParseDatetime("2018-04-28 10:21:15", 0)
+	d2, _ := types.ParseDatetime("2018-04-28 10:21:15.123", 0)
+	d3, _ := types.ParseDatetime("2015-03-03 12:12:12", 0)
 	var cases = []types.Datetime{
 		d1,
 		d2,
@@ -816,9 +816,9 @@ func make8ColumnsResultSet() *MysqlResultSet {
 	d1, _ := types.ParseDate("1997-01-01")
 	d2, _ := types.ParseDate("2008-02-02")
 
-	dt1, _ := types.ParseDatetime("2018-04-28 10:21:15")
-	dt2, _ := types.ParseDatetime("2018-04-28 10:21:15.123")
-	dt3, _ := types.ParseDatetime("2015-03-03 12:12:12")
+	dt1, _ := types.ParseDatetime("2018-04-28 10:21:15", 0)
+	dt2, _ := types.ParseDatetime("2018-04-28 10:21:15.123", 0)
+	dt3, _ := types.ParseDatetime("2015-03-03 12:12:12", 0)
 
 	var cases = [][]interface{}{
 		{int8(-128), int16(-32768), int32(-2147483648), int64(-9223372036854775808), "abc", float32(math.MaxFloat32), d1, dt1, float64(0.01)},
diff --git a/pkg/logservice/errors_test.go b/pkg/logservice/errors_test.go
index 8ed7ecd12..76867b330 100644
--- a/pkg/logservice/errors_test.go
+++ b/pkg/logservice/errors_test.go
@@ -18,6 +18,7 @@ import (
 	"errors"
 	"testing"
 
+	"github.com/lni/dragonboat/v4"
 	"github.com/stretchr/testify/assert"
 
 	pb "github.com/matrixorigin/matrixone/pkg/pb/logservice"
@@ -44,3 +45,36 @@ func TestUnknownErrorIsHandled(t *testing.T) {
 	assert.Equal(t, pb.ErrorCode_OtherSystemError, code)
 	assert.Equal(t, err.Error(), str)
 }
+
+func TestIsTempError(t *testing.T) {
+	tests := []struct {
+		err  error
+		temp bool
+	}{
+		{dragonboat.ErrInvalidOperation, false},
+		{dragonboat.ErrInvalidAddress, false},
+		{dragonboat.ErrInvalidSession, false},
+		{dragonboat.ErrTimeoutTooSmall, false},
+		{dragonboat.ErrPayloadTooBig, false},
+		{dragonboat.ErrSystemBusy, true},
+		{dragonboat.ErrShardClosed, true},
+		{dragonboat.ErrShardNotInitialized, true},
+		{dragonboat.ErrTimeout, true},
+		{dragonboat.ErrClosed, true},
+		{dragonboat.ErrCanceled, false},
+		{dragonboat.ErrRejected, false},
+		{dragonboat.ErrShardNotReady, true},
+		{dragonboat.ErrInvalidTarget, false},
+		{dragonboat.ErrInvalidRange, false},
+
+		{ErrDeadlineNotSet, false},
+		{ErrInvalidDeadline, false},
+		{ErrInvalidTruncateIndex, false},
+		{ErrNotLeaseHolder, false},
+		{ErrOutOfRange, false},
+		{ErrInvalidShardID, false},
+	}
+	for _, tt := range tests {
+		assert.Equal(t, tt.temp, isTempError(tt.err))
+	}
+}
diff --git a/pkg/logservice/transport_test.go b/pkg/logservice/transport_test.go
index d51c8be7a..aa8103df2 100644
--- a/pkg/logservice/transport_test.go
+++ b/pkg/logservice/transport_test.go
@@ -234,7 +234,7 @@ func TestReadMagicNumber(t *testing.T) {
 	conn := newTestConn()
 	_, err := conn.Write([]byte{0, 0})
 	assert.NoError(t, err)
-	assert.Equal(t, ErrBadMessage, readMagicNumber(conn, nil))
+	assert.Equal(t, errBadMessage, readMagicNumber(conn, nil))
 
 	conn = newTestConn()
 	_, err = conn.Write(magicNumber[:])
diff --git a/pkg/sql/parsers/dialect/mysql/mysql_sql_test.go b/pkg/sql/parsers/dialect/mysql/mysql_sql_test.go
index 9af5cfc7c..19c5aeb9f 100644
--- a/pkg/sql/parsers/dialect/mysql/mysql_sql_test.go
+++ b/pkg/sql/parsers/dialect/mysql/mysql_sql_test.go
@@ -804,7 +804,7 @@ var (
 		input: "create table t (a float(20, 20) not null, b int(20) null, c int(30) null)",
 	}, {
 		input:  "create table t1 (t time(3) null, dt datetime(6) null, ts timestamp(1) null)",
-		output: "create table t1 (t time(3) null, dt datetime(6) null, ts timestamp(1, 1) null)",
+		output: "create table t1 (t time(3) null, dt datetime(26, 6) null, ts timestamp(26, 1) null)",
 	}, {
 		input:  "create table t1 (a int default 1 + 1 - 2 * 3 / 4 div 7 ^ 8 << 9 >> 10 % 11)",
 		output: "create table t1 (a int default 1 + 1 - 2 * 3 / 4 div 7 ^ 8 << 9 >> 10 % 11)",
diff --git a/pkg/sql/plan2/function/builtin/multi/date_add_test.go b/pkg/sql/plan2/function/builtin/multi/date_add_test.go
index 9f3d5601a..528265413 100644
--- a/pkg/sql/plan2/function/builtin/multi/date_add_test.go
+++ b/pkg/sql/plan2/function/builtin/multi/date_add_test.go
@@ -163,7 +163,7 @@ func makeDateAddVectors(str string, isConst bool, num int64, unit types.Interval
 func makeDatetimeAddVectors(str string, isConst bool, num int64, unit types.IntervalType) []*vector.Vector {
 	vec := make([]*vector.Vector, 3)
 
-	datetime, _ := types.ParseDatetime(str)
+	datetime, _ := types.ParseDatetime(str, 0)
 
 	vec[0] = &vector.Vector{
 		Col:     []types.Datetime{datetime},
diff --git a/pkg/sql/plan2/function/builtin/multi/date_sub_test.go b/pkg/sql/plan2/function/builtin/multi/date_sub_test.go
index ef31c8303..2de3f561e 100644
--- a/pkg/sql/plan2/function/builtin/multi/date_sub_test.go
+++ b/pkg/sql/plan2/function/builtin/multi/date_sub_test.go
@@ -163,7 +163,7 @@ func makeDateSubVectors(str string, isConst bool, num int64, unit types.Interval
 func makeDatetimeSubVectors(str string, isConst bool, num int64, unit types.IntervalType) []*vector.Vector {
 	vec := make([]*vector.Vector, 3)
 
-	datetime, _ := types.ParseDatetime(str)
+	datetime, _ := types.ParseDatetime(str, 0)
 
 	vec[0] = &vector.Vector{
 		Col:     []types.Datetime{datetime},
diff --git a/pkg/sql/testutil/testutil.go b/pkg/sql/testutil/testutil.go
index 4bbbd3a82..c51269de9 100644
--- a/pkg/sql/testutil/testutil.go
+++ b/pkg/sql/testutil/testutil.go
@@ -318,7 +318,7 @@ func MakeDateTimeVector(values []string, nsp []uint64) *vector.Vector {
 		if nulls.Contains(vec.Nsp, uint64(i)) {
 			continue
 		}
-		d, err := types.ParseDatetime(s)
+		d, err := types.ParseDatetime(s, 6)
 		if err != nil {
 			panic(err)
 		}
@@ -331,7 +331,7 @@ func MakeDateTimeVector(values []string, nsp []uint64) *vector.Vector {
 func MakeScalarDateTime(value string, length int) *vector.Vector {
 	vec := NewProc().AllocScalarVector(dti)
 	vec.Length = length
-	d, err := types.ParseDatetime(value)
+	d, err := types.ParseDatetime(value, 6)
 	if err != nil {
 		panic(err)
 	}
@@ -401,7 +401,7 @@ func CompareVectors(expected *vector.Vector, got *vector.Vector) bool {
 			return false
 		}
 		if nulls.Any(expected.Nsp) {
-			var k uint64 = 0
+			k := uint64(0)
 			if !nulls.Any(got.Nsp) {
 				return false
 			}
diff --git a/pkg/sql/unittest/datatype_test.go b/pkg/sql/unittest/datatype_test.go
index 76357ed96..1a8dc3a82 100644
--- a/pkg/sql/unittest/datatype_test.go
+++ b/pkg/sql/unittest/datatype_test.go
@@ -246,7 +246,7 @@ func TestDatetimeType(t *testing.T) {
 		{sql: "select * from tbl2;", res: executeResult{
 			attr: []string{"a"},
 			data: [][]string{
-				{"2018-04-28 10:21:15.123000"}, {"2017-04-28 03:05:01.456000"}, {"2025-07-16 16:39:58.567000"}, {"2021-12-03 14:56:33.890000"}, {"null"},
+				{"2018-04-28 10:21:15"}, {"2017-04-28 03:05:01"}, {"2025-07-16 16:39:58"}, {"2021-12-03 14:56:33"}, {"null"},
 			},
 		}, com: "that is disputed. what does the msec do?"},
 		{sql: "select * from tbl3;", res: executeResult{
diff --git a/pkg/vectorize/fromunixtime/from_unixtime_test.go b/pkg/vectorize/fromunixtime/from_unixtime_test.go
index f899dc3a9..50f20db5f 100644
--- a/pkg/vectorize/fromunixtime/from_unixtime_test.go
+++ b/pkg/vectorize/fromunixtime/from_unixtime_test.go
@@ -22,7 +22,7 @@ import (
 )
 
 func mustDatetime(s string) types.Datetime {
-	datetime, err := types.ParseDatetime(s)
+	datetime, err := types.ParseDatetime(s, 6)
 	if err != nil {
 		panic("bad datetime")
 	}
diff --git a/pkg/vectorize/month/month_test.go b/pkg/vectorize/month/month_test.go
index 3c196f3da..6dde68111 100644
--- a/pkg/vectorize/month/month_test.go
+++ b/pkg/vectorize/month/month_test.go
@@ -27,7 +27,7 @@ func parseDate(s string) types.Date {
 }
 
 func parseDatetime(s string) types.Datetime {
-	dt, _ := types.ParseDatetime(s)
+	dt, _ := types.ParseDatetime(s, 6)
 	return dt
 }
 
diff --git a/pkg/vectorize/timestamp/utc_timestamp_test.go b/pkg/vectorize/timestamp/utc_timestamp_test.go
index 3098efa07..e62b97929 100644
--- a/pkg/vectorize/timestamp/utc_timestamp_test.go
+++ b/pkg/vectorize/timestamp/utc_timestamp_test.go
@@ -21,7 +21,7 @@ import (
 
 func TestUTCTimeStamp(t *testing.T) {
 	timestampStr := GetUTCTimestamp().String()
-	if _, err := types.ParseDatetime(timestampStr); err != nil {
+	if _, err := types.ParseDatetime(timestampStr, 6); err != nil {
 		t.Errorf("GetUTCTimestamp() error = %v\n", err)
 	}
 }
diff --git a/pkg/vectorize/unixtimestamp/unixtimestamp_test.go b/pkg/vectorize/unixtimestamp/unixtimestamp_test.go
index 4b55d4997..74946b6c8 100644
--- a/pkg/vectorize/unixtimestamp/unixtimestamp_test.go
+++ b/pkg/vectorize/unixtimestamp/unixtimestamp_test.go
@@ -22,7 +22,7 @@ import (
 )
 
 func mustDatetime(s string) types.Datetime {
-	datetime, err := types.ParseDatetime(s)
+	datetime, err := types.ParseDatetime(s, 6)
 	if err != nil {
 		panic("bad datetime")
 	}
diff --git a/pkg/vectorize/weekday/weekday_test.go b/pkg/vectorize/weekday/weekday_test.go
index 8299877df..81437c7b0 100644
--- a/pkg/vectorize/weekday/weekday_test.go
+++ b/pkg/vectorize/weekday/weekday_test.go
@@ -27,7 +27,7 @@ func parseDate(s string) types.Date {
 }
 
 func parseDatetime(s string) types.Datetime {
-	datetime, _ := types.ParseDatetime(s)
+	datetime, _ := types.ParseDatetime(s, 6)
 	return datetime
 }