@@ -58,11 +58,15 @@ class TSparsedMerger: public IColumnMerger {
5858
5959 void InitArrays (const ui32 position) {
6060 AFL_VERIFY (!ChunkAddress || ChunkFinishPosition <= position);
61- ChunkAddress = CurrentChunkedArray->GetChunk (ChunkAddress, position);
61+ AFL_VERIFY (CurrentOwnedArray->GetAddress ().GetGlobalStartPosition () <= position)(" pos" , position)(
62+ " global" , CurrentOwnedArray->GetAddress ().GetGlobalStartPosition ());
63+ ChunkAddress = CurrentChunkedArray->GetChunk (ChunkAddress, position - CurrentOwnedArray->GetAddress ().GetGlobalStartPosition ());
6264 AFL_VERIFY (ChunkAddress);
6365 ChunkStartPosition = CurrentOwnedArray->GetAddress ().GetGlobalStartPosition () + ChunkAddress->GetAddress ().GetGlobalStartPosition ();
6466 ChunkFinishPosition =
6567 CurrentOwnedArray->GetAddress ().GetGlobalStartPosition () + ChunkAddress->GetAddress ().GetGlobalFinishPosition ();
68+ AFL_VERIFY (position < ChunkFinishPosition)(" finish" , ChunkFinishPosition)(" pos" , position);
69+ AFL_VERIFY (ChunkStartPosition <= position)(" start" , ChunkStartPosition)(" pos" , position);
6670 }
6771
6872 public:
@@ -76,14 +80,15 @@ class TSparsedMerger: public IColumnMerger {
7680 }
7781 bool AddIndexTo (const ui32 index, TWriter& writer);
7882 std::optional<ui32> MoveToSignificant (const ui32 currentGlobalPosition, const TColumnMergeContext& context) {
79- AFL_VERIFY (ChunkStartPosition <= currentGlobalPosition);
83+ AFL_VERIFY (ChunkStartPosition <= currentGlobalPosition)(" start" , ChunkStartPosition)(" pos" , currentGlobalPosition)(
84+ " global_start" , CurrentOwnedArray->GetAddress ().GetGlobalStartPosition ());
8085 ui32 currentIndex = currentGlobalPosition;
8186 while (true ) {
8287 if (CurrentOwnedArray->GetAddress ().GetGlobalFinishPosition () <= currentIndex) {
8388 return {};
8489 }
8590 if (ChunkFinishPosition <= currentIndex) {
86- InitArrays (currentGlobalPosition );
91+ InitArrays (currentIndex );
8792 continue ;
8893 }
8994 for (; currentIndex < ChunkFinishPosition; ++currentIndex) {
@@ -190,6 +195,7 @@ class TSparsedMerger: public IColumnMerger {
190195 if (FinishGlobalPosition == Array->GetRecordsCount ()) {
191196 return FinishGlobalPosition;
192197 } else {
198+ currentPosition = FinishGlobalPosition;
193199 InitArrays (FinishGlobalPosition);
194200 }
195201 }
0 commit comments