@@ -151,6 +151,7 @@ public static void testScanImpl(String tableName) throws Exception {
151151 // 4. scan using setStartRow/setEndRow
152152 {
153153 Scan scan = new Scan ();
154+ scan .addFamily (family .getBytes ());
154155 scan .setStartRow (keys [0 ].getBytes ());
155156 scan .setStopRow (endKey .getBytes ());
156157 ResultScanner scanner = hTable .getScanner (scan );
@@ -173,15 +174,13 @@ public static void testScanImpl(String tableName) throws Exception {
173174 Scan scan = new Scan (keys [0 ].getBytes (), endKey .getBytes ());
174175 scan .addFamily (family .getBytes ());
175176 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" ));
182182 }
183- result = scanner .next ();
184- Assert .assertEquals (null , result );
183+
185184 }
186185
187186 // 7. scan using setAllowPartialResults/setAllowPartialResults
@@ -190,32 +189,25 @@ public static void testScanImpl(String tableName) throws Exception {
190189 scan .addFamily (family .getBytes ());
191190 scan .setMaxResultSize (10 );
192191 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" ));
198197 }
199- Result result = scanner .next ();
200- Assert .assertEquals (null , result );
201198 }
202199
203200 // 8. scan in reverse
204201 {
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+ }
219211 }
220212 }
221213
0 commit comments