@Override public int openScanner(ByteBuffer table, TScan scan) throws TIOError, TException { Table htable = getTable(table); ResultScanner resultScanner = null; try { resultScanner = htable.getScanner(scanFromThrift(scan)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } return addScanner(resultScanner); }
@Override public List<TResult> getScannerResults(ByteBuffer table, TScan scan, int numRows) throws TIOError, TException { Table htable = getTable(table); List<TResult> results = null; ResultScanner scanner = null; try { scanner = htable.getScanner(scanFromThrift(scan)); results = resultsFromHBase(scanner.next(numRows)); } catch (IOException e) { throw getTIOError(e); } finally { if (scanner != null) { scanner.close(); } closeTable(htable); } return results; }
Scan scan = scanFromThrift(tScan); assertArrayEquals(scan.getAttribute("attribute1"), attributeValue);
@Test public void testConsistency() throws Exception { byte[] rowName = Bytes.toBytes("testConsistency"); TGet tGet = new TGet(wrap(rowName)); tGet.setConsistency(TConsistency.STRONG); Get get = getFromThrift(tGet); assertEquals(Consistency.STRONG, get.getConsistency()); tGet.setConsistency(TConsistency.TIMELINE); tGet.setTargetReplicaId(1); get = getFromThrift(tGet); assertEquals(Consistency.TIMELINE, get.getConsistency()); assertEquals(1, get.getReplicaId()); TScan tScan = new TScan(); tScan.setConsistency(TConsistency.STRONG); Scan scan = scanFromThrift(tScan); assertEquals(Consistency.STRONG, scan.getConsistency()); tScan.setConsistency(TConsistency.TIMELINE); tScan.setTargetReplicaId(1); scan = scanFromThrift(tScan); assertEquals(Consistency.TIMELINE, scan.getConsistency()); assertEquals(1, scan.getReplicaId()); TResult tResult = new TResult(); assertFalse(tResult.isSetStale()); tResult.setStale(true); assertTrue(tResult.isSetStale()); }
@Override public int openScanner(ByteBuffer table, TScan scan) throws TIOError, TException { HTableInterface htable = getTable(table.array()); ResultScanner resultScanner = null; try { resultScanner = htable.getScanner(scanFromThrift(scan)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } return addScanner(resultScanner); }
@Override public int openScanner(ByteBuffer table, TScan scan) throws TIOError, TException { Table htable = getTable(table); ResultScanner resultScanner = null; try { resultScanner = htable.getScanner(scanFromThrift(scan)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } return addScanner(resultScanner); }
@Override public int openScanner(ByteBuffer table, TScan scan) throws TIOError, TException { Table htable = getTable(table); ResultScanner resultScanner = null; try { resultScanner = htable.getScanner(scanFromThrift(scan)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } return addScanner(resultScanner); }
@Override public List<TResult> getScannerResults(ByteBuffer table, TScan scan, int numRows) throws TIOError, TException { Table htable = getTable(table); List<TResult> results = null; ResultScanner scanner = null; try { scanner = htable.getScanner(scanFromThrift(scan)); results = resultsFromHBase(scanner.next(numRows)); } catch (IOException e) { throw getTIOError(e); } finally { if (scanner != null) { scanner.close(); } closeTable(htable); } return results; }
@Override public List<TResult> getScannerResults(ByteBuffer table, TScan scan, int numRows) throws TIOError, TException { Table htable = getTable(table); List<TResult> results = null; ResultScanner scanner = null; try { scanner = htable.getScanner(scanFromThrift(scan)); results = resultsFromHBase(scanner.next(numRows)); } catch (IOException e) { throw getTIOError(e); } finally { if (scanner != null) { scanner.close(); } closeTable(htable); } return results; }
Scan scan = scanFromThrift(tScan); assertArrayEquals(scan.getAttribute("attribute1"), attributeValue);
Scan scan = scanFromThrift(tScan); assertArrayEquals(scan.getAttribute("attribute1"), attributeValue);