code: func GetMinValue(ft *types.FieldType) (min types.Datum) {
  	switch ft.Tp {
  	case mysql.TypeTiny, mysql.TypeShort, mysql.TypeInt24, mysql.TypeLong, mysql.TypeLonglong:
  		if mysql.HasUnsignedFlag(ft.Flag) {
  			min.SetUint64(0)
  		} else {
  			min.SetInt64(types.IntergerSignedLowerBound(ft.Tp))
  		}
  	case mysql.TypeFloat:
  		min.SetFloat32(float32(-types.GetMaxFloat(ft.Flen, ft.Decimal)))
  	case mysql.TypeDouble:
  		min.SetFloat64(-types.GetMaxFloat(ft.Flen, ft.Decimal))
  	case mysql.TypeString, mysql.TypeVarString, mysql.TypeVarchar, mysql.TypeBlob, mysql.TypeTinyBlob, mysql.TypeMediumBlob, mysql.TypeLongBlob:
  		val := types.MinNotNullDatum()
  		bytes, err := codec.EncodeKey(nil, nil, val)
  		// should not happen
  		if err != nil {
  			logutil.Logger(context.Background()).Error("encode key fail", zap.Error(err))
  		}
  		min.SetBytes(bytes)
  	case mysql.TypeNewDecimal:
  		min.SetMysqlDecimal(types.NewMaxOrMinDec(true, ft.Flen, ft.Decimal))
  	case mysql.TypeDuration:
  		min.SetMysqlDuration(types.Duration{Duration: math.MinInt64})
  	case mysql.TypeDate, mysql.TypeDatetime, mysql.TypeTimestamp:
  		if ft.Tp == mysql.TypeDate || ft.Tp == mysql.TypeDatetime {
  			min.SetMysqlTime(types.Time{Time: types.MinDatetime, Type: ft.Tp})
  		} else {
  			min.SetMysqlTime(types.MinTimestamp)
  		}
  	}
  	return
  }
docs: // GetMinValue returns the min value datum for each type.