@@ -105,13 +105,15 @@ func NewIterator4Chunk(chk *Chunk) *Iterator4Chunk {
105
105
106
106
// Iterator4Chunk is used to iterate rows inside a chunk.
107
107
type Iterator4Chunk struct {
108
- chk * Chunk
109
- cursor int
108
+ chk * Chunk
109
+ cursor int32
110
+ numRows int32
110
111
}
111
112
112
113
// Begin implements the Iterator interface.
113
114
func (it * Iterator4Chunk ) Begin () Row {
114
- if it .chk .NumRows () == 0 {
115
+ it .numRows = int32 (it .chk .NumRows ())
116
+ if it .numRows == 0 {
115
117
return it .End ()
116
118
}
117
119
it .cursor = 1
@@ -120,21 +122,21 @@ func (it *Iterator4Chunk) Begin() Row {
120
122
121
123
// Next implements the Iterator interface.
122
124
func (it * Iterator4Chunk ) Next () Row {
123
- if it .cursor >= it .chk . NumRows () {
124
- it .cursor = it .chk . NumRows () + 1
125
+ if it .cursor >= it .numRows {
126
+ it .cursor = it .numRows + 1
125
127
return it .End ()
126
128
}
127
- row := it .chk .GetRow (it .cursor )
129
+ row := it .chk .GetRow (int ( it .cursor ) )
128
130
it .cursor ++
129
131
return row
130
132
}
131
133
132
134
// Current implements the Iterator interface.
133
135
func (it * Iterator4Chunk ) Current () Row {
134
- if it .cursor == 0 || it .cursor > it .Len () {
136
+ if it .cursor == 0 || int ( it .cursor ) > it .Len () {
135
137
return it .End ()
136
138
}
137
- return it .chk .GetRow (it .cursor - 1 )
139
+ return it .chk .GetRow (int ( it .cursor ) - 1 )
138
140
}
139
141
140
142
// End implements the Iterator interface.
@@ -144,7 +146,7 @@ func (it *Iterator4Chunk) End() Row {
144
146
145
147
// ReachEnd implements the Iterator interface.
146
148
func (it * Iterator4Chunk ) ReachEnd () {
147
- it .cursor = it .Len () + 1
149
+ it .cursor = int32 ( it .Len () + 1 )
148
150
}
149
151
150
152
// Len implements the Iterator interface
0 commit comments