int scanner = client.scannerOpen(ByteBuffer.wrap(t), ByteBuffer.wrap(bytes("")), columnNames, dummyAttributes);
scannerId = client.scannerOpen(ByteBuffer.wrap(TABLE), // co ThriftExample-6-Scan2 Scan again, but with another Thrift method. In addition, set the columns to a specific family only. Also print out the results in a loop. ByteBuffer.wrap(Bytes.toBytes("")), columnNames, null); for (TRowResult result : client.scannerGet(scannerId)) {
scannerId = client.scannerOpen(ByteBuffer.wrap(TABLE), ByteBuffer.wrap(Bytes.toBytes("")), columnNames, null); for (TRowResult result : client.scannerGet(scannerId)) {
int scanner = client.scannerOpen(ByteBuffer.wrap(t), ByteBuffer.wrap(bytes("")), columnNames, dummyAttributes);
private List<TRowResult> getRawRows(String tableName, Row startRow, int numberOfRows) { int scannerId; List<TRowResult> tRowResultList; try { synchronized (mutex) { List<ByteBuffer> columnNames=null; if (startRow!=null) { columnNames= startRow.getColumnNames(); } scannerId = client.scannerOpen( ByteBuffer.wrap(tableName.getBytes()), ByteBuffer.wrap(startRow==null?"".getBytes():startRow.getId()), columnNames, null); tRowResultList = client.scannerGetList(scannerId, numberOfRows); } } catch (IOError e) { throw new ReadTableException(EXCEPTION_DURING_FETCHING_ROWS, e); } catch (TException e) { throw new ReadTableException(EXCEPTION_DURING_FETCHING_ROWS, e); } return tRowResultList; }
private int getScanner(String tableName, Row startRow) { int scannerId; try { synchronized (mutex) { List<ByteBuffer> columnNames=null; if (startRow!=null) { columnNames= startRow.getColumnNames(); } scannerId = client.scannerOpen( ByteBuffer.wrap(tableName.getBytes()), ByteBuffer.wrap(startRow==null?"".getBytes():startRow.getId()), columnNames, null); } } catch (IOError e) { throw new ScannerException(EXCEPTION_DURING_OPENNING_SCANNER, e); } catch (TException e) { throw new ScannerException(EXCEPTION_DURING_OPENNING_SCANNER, e); } return scannerId; }
@Test(timeout = TestConstants.ITEST_TIMEOUT) public void test() throws Exception { ArrayList<ColumnDescriptor> columns = new ArrayList<ColumnDescriptor>(); ColumnDescriptor cd = new ColumnDescriptor(); cd.name = FAMILY1; columns.add(cd); cd = new ColumnDescriptor(); cd.name = FAMILY2; columns.add(cd); Hbase.Client client = controller.getThriftClient(); client.createTable(TABLE, columns); ArrayList<Mutation> mutations = new ArrayList<Mutation>(); mutations.add(new Mutation(false, COLUMN, VALUE, true)); client.mutateRow(TABLE, ROW, mutations, null); int scan1 = client.scannerOpen(TABLE, FIRST, Lists.newArrayList(FAMILY1), null); List<TRowResult> rows = client.scannerGet(scan1); assertThat(rows.size(), is(1)); assertThat(Bytes.toString(rows.get(0).getRow()), is("testRow")); assertTrue("No more rows", client.scannerGet(scan1).isEmpty()); client.scannerClose(scan1); int scan2 = client.scannerOpen(TABLE, FIRST, Lists.newArrayList(FAMILY2), null); assertTrue("No more rows", client.scannerGet(scan2).isEmpty()); client.scannerClose(scan2); }
private void getScanner(InetAddress thriftAddress) throws Exception { TTransport transport = new TSocket(thriftAddress.getHostName(), HBaseThriftServerClusterActionHandler.PORT); transport.open(); LOG.info("Connected to thrift server."); LOG.info("Waiting for .META. table..."); TProtocol protocol = new TBinaryProtocol(transport, true, true); Hbase.Client client = new Hbase.Client(protocol); int scannerId = client.scannerOpen(ByteBuffer.wrap(HConstants.META_TABLE_NAME), ByteBuffer.wrap(Bytes.toBytes("")), null, null); client.scannerClose(scannerId); thriftClient = client; }