@@ -151,6 +151,7 @@ public static void testScanImpl(String tableName) throws Exception {
151
151
// 4. scan using setStartRow/setEndRow
152
152
{
153
153
Scan scan = new Scan ();
154
+ scan .addFamily (family .getBytes ());
154
155
scan .setStartRow (keys [0 ].getBytes ());
155
156
scan .setStopRow (endKey .getBytes ());
156
157
ResultScanner scanner = hTable .getScanner (scan );
@@ -173,15 +174,13 @@ public static void testScanImpl(String tableName) throws Exception {
173
174
Scan scan = new Scan (keys [0 ].getBytes (), endKey .getBytes ());
174
175
scan .addFamily (family .getBytes ());
175
176
scan .setBatch (batchSize );
176
- ResultScanner scanner = hTable .getScanner (scan );
177
- Result result = null ;
178
- int resultSize = (keys .length * columns .length * values .length ) / batchSize ;
179
- for (int i = 0 ; i < resultSize ; i ++) {
180
- result = scanner .next ();
181
- Assert .assertEquals (2 , result .size ());
177
+ try {
178
+ ResultScanner scanner = hTable .getScanner (scan );
179
+ } catch (Exception e ) {
180
+ Assert .assertTrue (e .getCause ().getMessage ()
181
+ .contains ("timeseries hbase table with batch query not supported" ));
182
182
}
183
- result = scanner .next ();
184
- Assert .assertEquals (null , result );
183
+
185
184
}
186
185
187
186
// 7. scan using setAllowPartialResults/setAllowPartialResults
@@ -190,32 +189,25 @@ public static void testScanImpl(String tableName) throws Exception {
190
189
scan .addFamily (family .getBytes ());
191
190
scan .setMaxResultSize (10 );
192
191
scan .setAllowPartialResults (true );
193
- ResultScanner scanner = hTable . getScanner ( scan );
194
- int resultSize = keys . length * columns . length * values . length ;
195
- for ( int i = 0 ; i < resultSize ; i ++ ) {
196
- Result result = scanner . next ();
197
- Assert . assertEquals ( 1 , result . size ( ));
192
+ try {
193
+ ResultScanner scanner = hTable . getScanner ( scan ) ;
194
+ } catch ( Exception e ) {
195
+ Assert . assertTrue ( e . getCause (). getMessage ()
196
+ . contains ( "timeseries hbase table with allow partial results query not supported" ));
198
197
}
199
- Result result = scanner .next ();
200
- Assert .assertEquals (null , result );
201
198
}
202
199
203
200
// 8. scan in reverse
204
201
{
205
- // Scan scan = new Scan(keys[2].getBytes(), keys[0].getBytes());
206
- // scan.addFamily(family.getBytes());
207
- // scan.setReversed(true);
208
- // ResultScanner scanner = hTable.getScanner(scan);
209
- // List<Cell> cells = getCellsFromScanner(scanner);
210
- //
211
- // int cellIndex = 0;
212
- // for (int i = 1; i >= 0; i--) {
213
- // for (String column : columns) {
214
- // AssertKeyValue(keys[i], column, lastTs, latestValue, cells.get(cellIndex));
215
- // cellIndex++;
216
- // }
217
- // }
218
- // assertEquals(columns.length * 2, cells.size());
202
+ Scan scan = new Scan (keys [2 ].getBytes (), keys [0 ].getBytes ());
203
+ scan .addFamily (family .getBytes ());
204
+ scan .setReversed (true );
205
+ try {
206
+ ResultScanner scanner = hTable .getScanner (scan );
207
+ } catch (Exception e ) {
208
+ Assert .assertTrue (e .getCause ().getMessage ()
209
+ .contains ("timeseries hbase table with reverse query not supported" ));
210
+ }
219
211
}
220
212
}
221
213
0 commit comments