File tree Expand file tree Collapse file tree 2 files changed +21
-9
lines changed
main/java/tech/ydb/query/tools
test/java/tech/ydb/query/tools Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -176,12 +176,14 @@ public int getRowCount() {
176
176
177
177
@ Override
178
178
public void setRowIndex (int index ) {
179
- if (index < 0 || index >= rowsCount ) {
180
- throw new IndexOutOfBoundsException (String .format ("Index %s out of bounds for length %s" ,
181
- index , rowsCount ));
182
- }
179
+ // TODO: Enable after JDBC fixing
180
+ // if (index < 0 || index >= rowsCount) {
181
+ // throw new IndexOutOfBoundsException(String.format("Index %s out of bounds for length %s",
182
+ // index, rowsCount));
183
+ // }
184
+ // int currentIdx = index;
185
+ int currentIdx = Math .max (0 , index );
183
186
partIndex = 0 ;
184
- int currentIdx = index ;
185
187
while (partIndex < parts .length ) {
186
188
int readerRows = parts [partIndex ].getRowCount ();
187
189
if (currentIdx < readerRows ) {
@@ -193,6 +195,11 @@ public void setRowIndex(int index) {
193
195
partIndex ++;
194
196
}
195
197
198
+ // TODO: remove after JDBC fixing
199
+ if (partIndex >= parts .length ) {
200
+ partIndex = parts .length - 1 ;
201
+ }
202
+
196
203
for (int partStep = partIndex + 1 ; partStep < parts .length ; partStep ++) {
197
204
parts [partStep ].setRowIndex (0 );
198
205
}
Original file line number Diff line number Diff line change @@ -142,11 +142,16 @@ public void compositeResultSetTest() {
142
142
rsr .setRowIndex (5 );
143
143
Assert .assertEquals (1 , readAll (rsr , 5 ));
144
144
145
- IndexOutOfBoundsException ex1 = Assert . assertThrows ( IndexOutOfBoundsException . class , () -> rsr .setRowIndex (6 ) );
146
- Assert .assertEquals ("Index 6 out of bounds for length 6" , ex1 . getMessage ( ));
145
+ rsr .setRowIndex (- 1 );
146
+ Assert .assertEquals (6 , readAll ( rsr , 0 ));
147
147
148
- IndexOutOfBoundsException ex2 = Assert .assertThrows (IndexOutOfBoundsException .class , () -> rsr .setRowIndex (-1 ));
149
- Assert .assertEquals ("Index -1 out of bounds for length 6" , ex2 .getMessage ());
148
+ rsr .setRowIndex (6 );
149
+ Assert .assertEquals (0 , readAll (rsr , 0 ));
150
+ // IndexOutOfBoundsException ex1 = Assert.assertThrows(IndexOutOfBoundsException.class, () -> rsr.setRowIndex(6));
151
+ // Assert.assertEquals("Index 6 out of bounds for length 6", ex1.getMessage());
152
+ //
153
+ // IndexOutOfBoundsException ex2 = Assert.assertThrows(IndexOutOfBoundsException.class, () -> rsr.setRowIndex(-1));
154
+ // Assert.assertEquals("Index -1 out of bounds for length 6", ex2.getMessage());
150
155
}
151
156
152
157
private int readAll (ResultSetReader rsr , int startKey ) {
You can’t perform that action at this time.
0 commit comments