Skip to content

Commit

Permalink
*: fix ineffectual assignments and misspellings (pingcap#9481)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiekeyi98 authored Feb 28, 2019
1 parent 9259785 commit 2433e28
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion executor/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func (e *HashJoinExec) fetchOuterChunks(ctx context.Context) {
return
}
var outerResource *outerChkResource
ok := true
var ok bool
select {
case <-e.closeCh:
return
Expand Down
2 changes: 1 addition & 1 deletion executor/joiner.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ type joiner interface {
// Note that, for LeftOuterSemiJoin, AntiSemiJoin and AntiLeftOuterSemiJoin,
// we need to know the reason of outer row being treated as unmatched:
// whether the join condition returns false, or returns null, because
// it decides if this outer row should be outputed, hence we have a `hasNull`
// it decides if this outer row should be outputted, hence we have a `hasNull`
// parameter passed to `onMissMatch`.
onMissMatch(hasNull bool, outer chunk.Row, chk *chunk.Chunk)
}
Expand Down
3 changes: 2 additions & 1 deletion executor/radix_hash_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ func (e *RadixHashJoinExec) doInnerPartition(workerID int) {
// TODO: we need to evaluate the skewness for the partitions size, if the
// skewness exceeds a threshold, we do not use partition phase.
func (e *RadixHashJoinExec) preAlloc4InnerParts() (err error) {
hasNull, keyBuf := false, make([]byte, 0, 64)
var hasNull bool
keyBuf := make([]byte, 0, 64)
for chkIdx, chkNum := 0, e.innerResult.NumChunks(); chkIdx < chkNum; chkIdx++ {
chk := e.innerResult.GetChunk(chkIdx)
partPtrs := make([]partRowPtr, chk.NumRows())
Expand Down
3 changes: 2 additions & 1 deletion expression/builtin_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -5619,7 +5619,8 @@ func (b *builtinLastDaySig) evalTime(row chunk.Row) (types.Time, bool, error) {
return types.Time{}, true, handleInvalidTimeError(b.ctx, err)
}
tm := arg.Time
year, month, day := tm.Year(), tm.Month(), 30
var day int
year, month := tm.Year(), tm.Month()
if year == 0 && month == 0 && tm.Day() == 0 {
return types.Time{}, true, handleInvalidTimeError(b.ctx, types.ErrIncorrectDatetimeValue.GenWithStackByArgs(arg.String()))
}
Expand Down
6 changes: 4 additions & 2 deletions structure/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ func (t *TxStructure) loadHashMeta(metaKey []byte) (hashMeta, error) {
v, err := t.reader.Get(metaKey)
if kv.ErrNotExist.Equal(err) {
err = nil
} else if err != nil {
}
if err != nil {
return hashMeta{}, errors.Trace(err)
}

Expand All @@ -294,7 +295,8 @@ func (t *TxStructure) loadHashValue(dataKey []byte) ([]byte, error) {
if kv.ErrNotExist.Equal(err) {
err = nil
v = nil
} else if err != nil {
}
if err != nil {
return nil, errors.Trace(err)
}

Expand Down
3 changes: 2 additions & 1 deletion structure/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ func (t *TxStructure) loadListMeta(metaKey []byte) (listMeta, error) {
v, err := t.reader.Get(metaKey)
if kv.ErrNotExist.Equal(err) {
err = nil
} else if err != nil {
}
if err != nil {
return listMeta{}, errors.Trace(err)
}

Expand Down
9 changes: 7 additions & 2 deletions types/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -2206,7 +2206,13 @@ func GetFormatType(format string) (isDuration, isDate bool) {
}

format = skipWhiteSpace(format)
for token, formatRemain, succ := getFormatToken(format); len(token) != 0; format = formatRemain {
var token string
var succ bool
for {
token, format, succ = getFormatToken(format)
if len(token) == 0 {
break
}
if !succ {
isDuration, isDate = false, false
break
Expand All @@ -2219,7 +2225,6 @@ func GetFormatType(format string) (isDuration, isDate bool) {
if isDuration && isDate {
break
}
token, formatRemain, succ = getFormatToken(format)
}
return
}
Expand Down

0 comments on commit 2433e28

Please sign in to comment.