Skip to content

Commit

Permalink
refine code
Browse files Browse the repository at this point in the history
  • Loading branch information
crazycs520 committed Aug 28, 2018
1 parent 265dd58 commit 39cde9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions util/chunk/chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,20 @@ func (c *Chunk) BatchCopyJoinRowToChunk(isRight bool, chkForJoin *Chunk, outer R

// appendPartialRows appends multiple different rows to the chunk.
func appendPartialRows(colIdx, outerIdx int, chkForJoin, chk *Chunk, selected []bool) int {
rowNum := 0
oldLen := chk.NumRows()
var columns []*column
if colIdx == 0 {
columns = chkForJoin.columns[:outerIdx]
} else {
columns = chkForJoin.columns[colIdx:]
}

for i := 0; i < len(selected); i++ {
if !selected[i] {
continue
}
for j, rowCol := range columns {
chkCol := chk.columns[colIdx+j]
for j, rowCol := range columns {
chkCol := chk.columns[colIdx+j]
for i := 0; i < len(selected); i++ {
if !selected[i] {
continue
}
chkCol.appendNullBitmap(!rowCol.isNull(i))
chkCol.length++

Expand All @@ -205,9 +205,8 @@ func appendPartialRows(colIdx, outerIdx int, chkForJoin, chk *Chunk, selected []
chkCol.offsets = append(chkCol.offsets, int32(len(chkCol.data)))
}
}
rowNum++
}
return rowNum
return chk.NumRows() - oldLen
}

// appendPartialSameRows appends same row to the chunk with `rowNum` times.
Expand Down
2 changes: 1 addition & 1 deletion util/chunk/chunk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package chunk
import (
"fmt"
"math"
"reflect"
"testing"
"time"
"unsafe"
Expand All @@ -26,7 +27,6 @@ import (
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/types/json"
"github.com/pingcap/tidb/util/hack"
"reflect"
)

func TestT(t *testing.T) {
Expand Down

0 comments on commit 39cde9c

Please sign in to comment.