Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.Increment.addColumn()


  }

  public static Increment incrementFromThrift(TIncrement in) throws IOException {
    Increment out = new Increment(in.getRow());
    for (TColumnIncrement column : in.getColumns()) {
      out.addColumn(column.getFamily(), column.getQualifier(), column.getAmount());
    }

    if (in.isSetAttributes()) {
      addAttributes(out,in.getAttributes());
    }
View Full Code Here


  public void testIncrementHook() throws IOException {
    TableName tableName = TEST_TABLE;

    HTable table = util.createTable(tableName, new byte[][] {A, B, C});
    Increment inc = new Increment(Bytes.toBytes(0));
    inc.addColumn(A, A, 1);

    verifyMethodResult(SimpleRegionObserver.class,
        new String[] {"hadPreIncrement", "hadPostIncrement"},
        tableName,
        new Boolean[] {false, false}
View Full Code Here

          byte[] qualifier = qv.getQualifier().toByteArray();
          if (!qv.hasValue()) {
            throw new DoNotRetryIOException("Missing required field: qualifer value");
          }
          long value = Bytes.toLong(qv.getValue().toByteArray());
          increment.addColumn(family, qualifier, value);
        }
      }
    }
    if (proto.hasTimeRange()) {
      HBaseProtos.TimeRange timeRange = proto.getTimeRange();
View Full Code Here

  public void testIncrWithReadOnlyTable() throws Exception {
    byte[] TABLE = Bytes.toBytes("readOnlyTable");
    this.region = initHRegion(TABLE, getName(), conf, true, Bytes.toBytes("somefamily"));
    boolean exceptionCaught = false;   
    Increment inc = new Increment(Bytes.toBytes("somerow"));
    inc.addColumn(Bytes.toBytes("somefamily"), Bytes.toBytes("somequalifier"), 1L);
    try {
      region.increment(inc, false);
    } catch (IOException e) {
      exceptionCaught = true;
    } finally {
View Full Code Here

      Put put1 = new Put(row1);
      put1.add(fam1, qual1, Bytes.toBytes(row1Field1));
      put1.add(fam1, qual2, Bytes.toBytes(row1Field2));
      region.put(put1);
      Increment increment = new Increment(row1);
      increment.addColumn(fam1, qual1, 1);

      //here we should be successful as normal
      region.increment(increment, null, true);
      assertICV(row1, fam1, qual1, row1Field1 + 1);
View Full Code Here

      region.increment(increment, null, true);
      assertICV(row1, fam1, qual1, row1Field1 + 1);

      //failed to increment
      increment = new Increment(row1);
      increment.addColumn(fam1, qual2, 1);
      try {
        region.increment(increment, null, true);
        fail("Expected to fail here");
      } catch (Exception exception) {
        // Expected.
View Full Code Here

    @Override
    public void run() {
      int count = 0;
      while (count < incCounter) {
        Increment inc = new Increment(incRow);
        inc.addColumn(family, qualifier, ONE);
        count++;
        try {
          region.increment(inc, null, true);
        } catch (IOException e) {
          e.printStackTrace();
View Full Code Here

      public Void run() throws Exception {
        HTable t = new HTable(conf, TEST_TABLE.getTableName());
        try {
          Increment inc = new Increment(TEST_ROW1);
          inc.setTimeRange(0, 123);
          inc.addColumn(TEST_FAMILY1, TEST_Q1, 2L);
          t.increment(inc);
          t.incrementColumnValue(TEST_ROW1, TEST_FAMILY1, TEST_Q2, 1L);
        } finally {
          t.close();
        }
View Full Code Here

      public Void run() throws Exception {
        HTable t = new HTable(conf, TEST_TABLE.getTableName());
        try {
          Increment inc = new Increment(TEST_ROW1);
          inc.setTimeRange(0, 127);
          inc.addColumn(TEST_FAMILY1, TEST_Q2, 2L);
          t.increment(inc);
          fail();
        } catch (Exception e) {

        } finally {
View Full Code Here

    @Override
    public void run() {
      int count = 0;
      while (count < incCounter) {
        Increment inc = new Increment(incRow);
        inc.addColumn(family, qualifier, ONE);
        count++;
        try {
          region.increment(inc);
        } catch (IOException e) {
          e.printStackTrace();
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.