Skip to content

Commit 216d65f

Browse files
maochongxinstuBirdFly
authored andcommitted
check not support cases
(cherry picked from commit 826e980)
1 parent cff129c commit 216d65f

File tree

2 files changed

+25
-39
lines changed

2 files changed

+25
-39
lines changed

src/test/java/com/alipay/oceanbase/hbase/secondary/OHTableSecondaryPartScanTest.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,17 +226,11 @@ public static void testScanImpl(String tableName) throws Exception {
226226
Scan scan = new Scan(keys[1].getBytes(), "putKey".getBytes());
227227
scan.addFamily(family.getBytes());
228228
scan.setReversed(true);
229-
ResultScanner scanner = hTable.getScanner(scan);
230-
List<Cell> cells = getCellsFromScanner(scanner);
231-
232-
int cellIndex = 0;
233-
for (int i = 1; i >= 0; i--) {
234-
for (String column : columns) {
235-
AssertKeyValue(keys[i], column, lastTs, latestValue, cells.get(cellIndex));
236-
cellIndex++;
237-
}
229+
try {
230+
hTable.getScanner(scan);
231+
} catch (Exception e) {
232+
Assert.assertTrue(e.getCause().getMessage().contains("secondary partitioned hbase table with reverse query not supported"));
238233
}
239-
assertEquals(columns.length * 2, cells.size());
240234
}
241235
hTable.close();
242236
}

src/test/java/com/alipay/oceanbase/hbase/secondary/OHTableTimeSeriesScanTest.java

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)