@@ -155,7 +155,7 @@ class IScanCursor {
155155
156156 virtual const std::shared_ptr<NArrow::TSimpleRow>& DoGetPKCursor () const = 0;
157157 virtual bool DoCheckEntityIsBorder (const ICursorEntity& entity, bool & usage) const = 0;
158- virtual bool DoCheckSourceIntervalUsage (const ui64 sourceId , const ui32 indexStart, const ui32 recordsCount) const = 0;
158+ virtual bool DoCheckSourceIntervalUsage (const ui32 sourceIdx , const ui32 indexStart, const ui32 recordsCount) const = 0;
159159 virtual TConclusionStatus DoDeserializeFromProto (const NKikimrKqp::TEvKqpScanCursor& proto) = 0;
160160 virtual void DoSerializeToProto (NKikimrKqp::TEvKqpScanCursor& proto) const = 0;
161161
@@ -168,9 +168,9 @@ class IScanCursor {
168168 return DoGetPKCursor ();
169169 }
170170
171- bool CheckSourceIntervalUsage (const ui64 sourceId , const ui32 indexStart, const ui32 recordsCount) const {
171+ bool CheckSourceIntervalUsage (const ui32 sourceIdx , const ui32 indexStart, const ui32 recordsCount) const {
172172 AFL_VERIFY (IsInitialized ());
173- return DoCheckSourceIntervalUsage (sourceId , indexStart, recordsCount);
173+ return DoCheckSourceIntervalUsage (sourceIdx , indexStart, recordsCount);
174174 }
175175
176176 bool CheckEntityIsBorder (const ICursorEntity& entity, bool & usage) const {
@@ -198,11 +198,12 @@ class IScanCursor {
198198class TSimpleScanCursor : public IScanCursor {
199199private:
200200 YDB_READONLY_DEF (std::shared_ptr<NArrow::TSimpleRow>, PrimaryKey);
201- YDB_READONLY (ui64, SourceId, 0 ) ;
201+ std::optional<ui32> SourceIdx ;
202202 YDB_READONLY (ui32, RecordIndex, 0 );
203203
204204 virtual void DoSerializeToProto (NKikimrKqp::TEvKqpScanCursor& proto) const override {
205- proto.MutableColumnShardSimple ()->SetSourceId (SourceId);
205+ AFL_VERIFY (SourceIdx);
206+ proto.MutableColumnShardSimple ()->SetSourceIdx (*SourceIdx);
206207 proto.MutableColumnShardSimple ()->SetStartRecordIndex (RecordIndex);
207208 }
208209
@@ -211,11 +212,12 @@ class TSimpleScanCursor: public IScanCursor {
211212 }
212213
213214 virtual bool IsInitialized () const override {
214- return !!SourceId ;
215+ return !!SourceIdx ;
215216 }
216217
217218 virtual bool DoCheckEntityIsBorder (const ICursorEntity& entity, bool & usage) const override {
218- if (SourceId != entity.GetEntityId ()) {
219+ AFL_VERIFY (SourceIdx);
220+ if (*SourceIdx != entity.GetEntityId ()) {
219221 return false ;
220222 }
221223 if (!entity.GetEntityRecordsCount ()) {
@@ -231,19 +233,20 @@ class TSimpleScanCursor: public IScanCursor {
231233 if (!proto.HasColumnShardSimple ()) {
232234 return TConclusionStatus::Fail (" absent sorted cursor data" );
233235 }
234- if (!proto.GetColumnShardSimple ().HasSourceId ()) {
236+ if (!proto.GetColumnShardSimple ().HasSourceIdx ()) {
235237 return TConclusionStatus::Fail (" incorrect source id for cursor initialization" );
236238 }
237- SourceId = proto.GetColumnShardSimple ().GetSourceId ();
239+ SourceIdx = proto.GetColumnShardSimple ().GetSourceIdx ();
238240 if (!proto.GetColumnShardSimple ().HasStartRecordIndex ()) {
239241 return TConclusionStatus::Fail (" incorrect record index for cursor initialization" );
240242 }
241243 RecordIndex = proto.GetColumnShardSimple ().GetStartRecordIndex ();
242244 return TConclusionStatus::Success ();
243245 }
244246
245- virtual bool DoCheckSourceIntervalUsage (const ui64 sourceId, const ui32 indexStart, const ui32 recordsCount) const override {
246- AFL_VERIFY (sourceId == SourceId);
247+ virtual bool DoCheckSourceIntervalUsage (const ui32 sourceIdx, const ui32 indexStart, const ui32 recordsCount) const override {
248+ AFL_VERIFY (SourceIdx);
249+ AFL_VERIFY (sourceIdx == *SourceIdx);
247250 if (indexStart >= RecordIndex) {
248251 return true ;
249252 }
@@ -254,22 +257,23 @@ class TSimpleScanCursor: public IScanCursor {
254257public:
255258 TSimpleScanCursor () = default ;
256259
257- TSimpleScanCursor (const std::shared_ptr<NArrow::TSimpleRow>& pk, const ui64 portionId , const ui32 recordIndex)
260+ TSimpleScanCursor (const std::shared_ptr<NArrow::TSimpleRow>& pk, const ui32 sourceIdx , const ui32 recordIndex)
258261 : PrimaryKey(pk)
259- , SourceId(portionId )
262+ , SourceIdx(sourceIdx )
260263 , RecordIndex(recordIndex)
261264 {
262265 }
263266};
264267
265268class TNotSortedSimpleScanCursor : public TSimpleScanCursor {
266269private:
267- YDB_READONLY (ui64, SourceId, 0 ) ;
270+ std::optional<ui32> SourceIdx ;
268271 YDB_READONLY (ui32, RecordIndex, 0 );
269272
270273 virtual void DoSerializeToProto (NKikimrKqp::TEvKqpScanCursor& proto) const override {
271274 auto & data = *proto.MutableColumnShardNotSortedSimple ();
272- data.SetSourceId (SourceId);
275+ AFL_VERIFY (SourceIdx);
276+ data.SetSourceIdx (*SourceIdx);
273277 data.SetStartRecordIndex (RecordIndex);
274278 }
275279
@@ -278,11 +282,12 @@ class TNotSortedSimpleScanCursor: public TSimpleScanCursor {
278282 }
279283
280284 virtual bool IsInitialized () const override {
281- return !!SourceId ;
285+ return !!SourceIdx ;
282286 }
283287
284288 virtual bool DoCheckEntityIsBorder (const ICursorEntity& entity, bool & usage) const override {
285- if (SourceId != entity.GetEntityId ()) {
289+ AFL_VERIFY (SourceIdx);
290+ if (*SourceIdx != entity.GetEntityId ()) {
286291 return false ;
287292 }
288293 if (!entity.GetEntityRecordsCount ()) {
@@ -299,19 +304,20 @@ class TNotSortedSimpleScanCursor: public TSimpleScanCursor {
299304 return TConclusionStatus::Fail (" absent unsorted cursor data" );
300305 }
301306 auto & data = proto.GetColumnShardNotSortedSimple ();
302- if (!data.HasSourceId ()) {
303- return TConclusionStatus::Fail (" incorrect source id for cursor initialization" );
307+ if (!data.HasSourceIdx ()) {
308+ return TConclusionStatus::Fail (" incorrect source index for cursor initialization" );
304309 }
305- SourceId = data.GetSourceId ();
310+ SourceIdx = data.GetSourceIdx ();
306311 if (!data.HasStartRecordIndex ()) {
307312 return TConclusionStatus::Fail (" incorrect record index for cursor initialization" );
308313 }
309314 RecordIndex = data.GetStartRecordIndex ();
310315 return TConclusionStatus::Success ();
311316 }
312317
313- virtual bool DoCheckSourceIntervalUsage (const ui64 sourceId, const ui32 indexStart, const ui32 recordsCount) const override {
314- AFL_VERIFY (sourceId == SourceId);
318+ virtual bool DoCheckSourceIntervalUsage (const ui32 sourceIdx, const ui32 indexStart, const ui32 recordsCount) const override {
319+ AFL_VERIFY (SourceIdx);
320+ AFL_VERIFY (sourceIdx == *SourceIdx);
315321 if (indexStart >= RecordIndex) {
316322 return true ;
317323 }
@@ -322,8 +328,8 @@ class TNotSortedSimpleScanCursor: public TSimpleScanCursor {
322328public:
323329 TNotSortedSimpleScanCursor () = default ;
324330
325- TNotSortedSimpleScanCursor (const ui64 portionId , const ui32 recordIndex)
326- : SourceId(portionId )
331+ TNotSortedSimpleScanCursor (const ui32 sourceIdx , const ui32 recordIndex)
332+ : SourceIdx(sourceIdx )
327333 , RecordIndex(recordIndex)
328334 {
329335 }
@@ -355,7 +361,7 @@ class TPlainScanCursor: public IScanCursor {
355361 return true ;
356362 }
357363
358- virtual bool DoCheckSourceIntervalUsage (const ui64 /* sourceId */ , const ui32 /* indexStart*/ , const ui32 /* recordsCount*/ ) const override {
364+ virtual bool DoCheckSourceIntervalUsage (const ui32 /* sourceIdx */ , const ui32 /* indexStart*/ , const ui32 /* recordsCount*/ ) const override {
359365 return true ;
360366 }
361367
0 commit comments