Skip to content

Commit

Permalink
*: remove useless else (#31715)
Browse files Browse the repository at this point in the history
ref #31716
  • Loading branch information
hawkingrei authored Jan 17, 2022
1 parent 4bab2b6 commit 4fd9f78
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
6 changes: 2 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,9 @@ func (c *Config) getTiKVConfig() *tikvcfg.Config {

func encodeDefTempStorageDir(tempDir string, host, statusHost string, port, statusPort uint) string {
dirName := base64.URLEncoding.EncodeToString([]byte(fmt.Sprintf("%v:%v/%v:%v", host, port, statusHost, statusPort)))
var osUID string
osUID := ""
currentUser, err := user.Current()
if err != nil {
osUID = ""
} else {
if err == nil {
osUID = currentUser.Uid
}
return filepath.Join(tempDir, osUID+"_tidb", dirName, "tmp-storage")
Expand Down
2 changes: 0 additions & 2 deletions expression/builtin_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,6 @@ func (b *builtinJSONValidStringSig) evalInt(row chunk.Row) (res int64, isNull bo
data := hack.Slice(val)
if goJSON.Valid(data) {
res = 1
} else {
res = 0
}
return res, false, nil
}
Expand Down
4 changes: 1 addition & 3 deletions server/driver_tidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,7 @@ func convertColumnInfo(fld *ast.ResultField) (ci *ColumnInfo) {
if fld.Table != nil {
ci.OrgTable = fld.Table.Name.O
}
if fld.Column.Flen == types.UnspecifiedLength {
ci.ColumnLength = 0
} else {
if fld.Column.Flen != types.UnspecifiedLength {
ci.ColumnLength = uint32(fld.Column.Flen)
}
if fld.Column.Tp == mysql.TypeNewDecimal {
Expand Down
5 changes: 1 addition & 4 deletions sessionctx/variable/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -1304,11 +1304,9 @@ func NewSessionVars() *SessionVars {
vars.enforceMPPExecution = DefTiDBEnforceMPPExecution
vars.MPPStoreFailTTL = DefTiDBMPPStoreFailTTL

var enableChunkRPC string
enableChunkRPC := "0"
if config.GetGlobalConfig().TiKVClient.EnableChunkRPC {
enableChunkRPC = "1"
} else {
enableChunkRPC = "0"
}
terror.Log(vars.SetSystemVar(TiDBEnableChunkRPC, enableChunkRPC))
for _, engine := range config.GetGlobalConfig().IsolationRead.Engines {
Expand Down Expand Up @@ -2196,7 +2194,6 @@ func (s *SessionVars) SlowLogFormat(logItems *SlowQueryLogItems) string {
vStr = "pseudo"
} else {
vStr = strconv.FormatUint(v, 10)

}
if firstComma {
buf.WriteString("," + k + ":" + vStr)
Expand Down

0 comments on commit 4fd9f78

Please sign in to comment.