@@ -73,10 +73,8 @@ class TChargeBTreeIndex : public ICharge {
73
73
endRowId++; // current interface accepts inclusive row2 bound
74
74
Y_ABORT_UNLESS (beginRowId < endRowId);
75
75
76
- Cerr << " Do " << " " << beginRowId << " " << endRowId << Endl;
77
-
78
76
bool ready = true ;
79
- bool chargeGroups = true ; // false value means that beginRowId, endRowId are invalid and shouldn't be used
77
+ bool chargeGroups = bool (Groups) ; // false value means that beginRowId, endRowId are invalid and shouldn't be used
80
78
81
79
Y_UNUSED (itemsLimit);
82
80
Y_UNUSED (bytesLimit);
@@ -154,18 +152,16 @@ class TChargeBTreeIndex : public ICharge {
154
152
};
155
153
156
154
const auto tryHandleDataPage = [&](TChildState child) -> bool {
157
- if (child.PageId == key1PageId || child.PageId == key2PageId) {
155
+ if (chargeGroups && ( child.PageId == key1PageId || child.PageId == key2PageId) ) {
158
156
const auto page = TryGetDataPage (child.PageId , { });
159
157
if (page) { // update beginRowId, endRowId
160
158
auto data = NPage::TDataPage (page);
161
159
if (child.PageId == key1PageId) {
162
160
TRowId key1RowId = data.BaseRow () + data.LookupKey (key1, Scheme.Groups [0 ], ESeek::Lower, &keyDefaults).Off ();
163
- Cerr << " key1RowId " << key1RowId << Endl;
164
161
beginRowId = Max (beginRowId, key1RowId);
165
162
}
166
163
if (child.PageId == key2PageId) {
167
164
TRowId key2RowId = data.BaseRow () + data.LookupKey (key2, Scheme.Groups [0 ], ESeek::Upper, &keyDefaults).Off ();
168
- Cerr << " key2RowId " << key2RowId << Endl;
169
165
endRowId = Min (endRowId, key2RowId);
170
166
}
171
167
return true ;
@@ -218,10 +214,8 @@ class TChargeBTreeIndex : public ICharge {
218
214
endRowId++; // current interface accepts inclusive row1 bound
219
215
Y_ABORT_UNLESS (beginRowId < endRowId);
220
216
221
- Cerr << " DoReverse " << " " << beginRowId << " " << endRowId << Endl;
222
-
223
217
bool ready = true ;
224
- bool chargeGroups = true ; // false value means that beginRowId, endRowId are invalid and shouldn't be used
218
+ bool chargeGroups = bool (Groups) ; // false value means that beginRowId, endRowId are invalid and shouldn't be used
225
219
226
220
Y_UNUSED (itemsLimit);
227
221
Y_UNUSED (bytesLimit);
@@ -272,18 +266,16 @@ class TChargeBTreeIndex : public ICharge {
272
266
TRecIdx pos = node.SeekReverse (ESeek::Lower, key1, Scheme.Groups [0 ].ColsKeyIdx , &keyDefaults);
273
267
key1PageId = node.GetShortChild (pos).PageId ;
274
268
endRowId = Min (endRowId, node.GetShortChild (pos).RowCount ); // move endRowId - 1 to the last key <= key1
275
- Cerr << " End " << endRowId << " " << node.GetShortChild (pos).RowCount << Endl;
276
- // ??? v
277
- if (pos && node.GetShortChild (pos - 1 ).RowCount >= endRowId) {
278
- chargeGroups = false ; // key1 is after current slice
279
- }
280
269
}
281
270
if (child.PageId == key2PageId) {
282
271
TRecIdx pos = node.Seek (ESeek::Lower, key2, Scheme.Groups [0 ].ColsKeyIdx , &keyDefaults);
283
272
key2PageId = node.GetShortChild (pos).PageId ;
284
273
if (pos) {
285
274
beginRowId = Max (beginRowId, node.GetShortChild (pos - 1 ).RowCount - 1 ); // move beginRowId to the last key < key2
286
- }
275
+ if (node.GetShortChild (pos - 1 ).RowCount >= endRowId) {
276
+ chargeGroups = false ; // key2 is after current slice
277
+ }
278
+ }
287
279
}
288
280
return true ;
289
281
} else { // skip unloaded page rows
@@ -301,15 +293,14 @@ class TChargeBTreeIndex : public ICharge {
301
293
};
302
294
303
295
const auto tryHandleDataPage = [&](TChildState child) -> bool {
304
- if (child.PageId == key1PageId || child.PageId == key2PageId) {
296
+ if (chargeGroups && ( child.PageId == key1PageId || child.PageId == key2PageId) ) {
305
297
const auto page = TryGetDataPage (child.PageId , { });
306
298
if (page) { // update beginRowId, endRowId
307
299
auto data = NPage::TDataPage (page);
308
300
if (child.PageId == key1PageId) {
309
301
auto iter = data.LookupKeyReverse (key1, Scheme.Groups [0 ], ESeek::Lower, &keyDefaults);
310
302
if (iter) {
311
303
TRowId key1RowId = data.BaseRow () + iter.Off ();
312
- Cerr << " key1RowId " << key1RowId << Endl;
313
304
endRowId = Min (endRowId, key1RowId + 1 );
314
305
} else {
315
306
endRowId = Min (endRowId, child.BeginRowId );
@@ -319,7 +310,6 @@ class TChargeBTreeIndex : public ICharge {
319
310
auto iter = data.LookupKeyReverse (key2, Scheme.Groups [0 ], ESeek::Upper, &keyDefaults);
320
311
if (iter) {
321
312
TRowId key2RowId = data.BaseRow () + iter.Off ();
322
- Cerr << " key2RowId " << key2RowId << Endl;
323
313
beginRowId = Max (beginRowId, key2RowId + 1 );
324
314
} else {
325
315
beginRowId = Max (beginRowId, child.BeginRowId );
@@ -372,7 +362,6 @@ class TChargeBTreeIndex : public ICharge {
372
362
373
363
private:
374
364
bool DoPrechargeGroups (bool chargeGroups, TRowId beginRowId, TRowId endRowId) const noexcept {
375
- Cerr << " Groups " << chargeGroups << " " << beginRowId << " " << endRowId << Endl;
376
365
bool ready = true ;
377
366
378
367
if (chargeGroups && beginRowId < endRowId) {
0 commit comments