Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.HTableInterface.batch()


      return;
    }
    HTableInterface table = null;
    try {
      table = this.pool.getTable(tableName);
      table.batch(rows);
      this.metrics.appliedOpsRate.inc(rows.size());
    } catch (InterruptedException ix) {
      throw new IOException(ix);
    } finally {
      if (table != null) {
View Full Code Here


    public void testBatchNewResultArray() throws Exception {
        HTableInterface hTable = getHTable();
        byte[] row = randomRowKey();
        Put put = new Put(row);
        put.add(cf, row, row); // put whatever, just write something into the row
        hTable.batch(ImmutableList.<Row>of(put));
       
        Get get = new Get(row);
        Assert.assertTrue(hTable.exists(get));
       
        assertMetricsUpdated(OpType.BATCH, OpType.EXISTS);
View Full Code Here

    public void testBatchPassedResultArray() throws Exception {
        HTableInterface hTable = getHTable();
        byte[] row = randomRowKey();
        Put put = new Put(row);
        put.add(cf, row, row); // put whatever, just write something into the row
        hTable.batch(ImmutableList.<Row>of(put));
       
        Object[] results = new Result[1];
        Get get = new Get(row);
        hTable.batch(ImmutableList.<Row>of(get), results);
       
View Full Code Here

        put.add(cf, row, row); // put whatever, just write something into the row
        hTable.batch(ImmutableList.<Row>of(put));
       
        Object[] results = new Result[1];
        Get get = new Get(row);
        hTable.batch(ImmutableList.<Row>of(get), results);
       
        Assert.assertArrayEquals(row, ((Result)(results[0])).getRow());
        assertMetricsUpdated(OpType.BATCH);
    }
View Full Code Here

        Put put1 = new Put(row1);
        put1.add(cf, row1, row1);
        Put put2 = new Put(row2);
        put2.add(cf, row2, row2);
       
        hTable.batch(ImmutableList.<Row>of(put1, put2));
       
        List<Get> gets = ImmutableList.<Get>of(new Get(row1), new Get(row2));
        Result[] results = hTable.get(gets);

        Assert.assertArrayEquals(row1, results[0].getRow());
View Full Code Here

        Put put1 = new Put(rows.get(0));
        Put put2 = new Put(rows.get(1));
        put1.add(cf, rows.get(0), rows.get(0));
        put2.add(cf, rows.get(1), rows.get(1));
        hTable.batch(ImmutableList.<Row>of(put1, put2));

        ResultScanner rs = hTable.getScanner(new Scan());
       
        Result[] results = rs.next(2);
        Assert.assertArrayEquals(rows.get(0), results[0].getRow());
View Full Code Here

            final Put put2 = new Put("junit2".getBytes());
            put2.add("bar".getBytes(), "bah".getBytes(), new byte[] { 1, 2, 3 });
            put2.add("bar".getBytes(), "hi".getBytes(), "you".getBytes());

            hTable.batch(Arrays.asList(put1, put2));
        } finally {
            hTable.close();
            tablePool.closeTablePool(EXAMPLE_TABLE_NAME);
            tablePool.close();
        }
View Full Code Here

    }
    HTableInterface table = null;
    try {
      table = this.sharedHtableCon.getTable(tableName);
      for (List<Row> rows : allRows) {
        table.batch(rows);
      }
    } catch (InterruptedException ix) {
      throw new IOException(ix);
    } finally {
      if (table != null) {
View Full Code Here

    }
    HTableInterface table = null;
    try {
      table = this.sharedHtableCon.getTable(tableName);
      for (List<Row> rows : allRows) {
        table.batch(rows);
        this.metrics.appliedOpsRate.inc(rows.size());
      }
    } catch (InterruptedException ix) {
      throw new IOException(ix);
    } finally {
View Full Code Here

        boolean writeToWAL) throws IOException {
      HTableInterface table = e.getEnvironment().getTable(otherTable, getPool());
      Put p = new Put(new byte[] { 'a' });
      p.add(family, null, new byte[] { 'a' });
      try {
        table.batch(Collections.singletonList(put));
      } catch (InterruptedException e1) {
        throw new IOException(e1);
      }
      completedWithPool[0] = true;
      table.close();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.