当前位置: 首页>>代码示例>>Java>>正文


Java Append.add方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.client.Append.add方法的典型用法代码示例。如果您正苦于以下问题:Java Append.add方法的具体用法?Java Append.add怎么用?Java Append.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.client.Append的用法示例。


在下文中一共展示了Append.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: appendFromThrift

import org.apache.hadoop.hbase.client.Append; //导入方法依赖的package包/类
public static Append appendFromThrift(TAppend append) throws IOException {
  Append out = new Append(append.getRow());
  for (TColumnValue column : append.getColumns()) {
    out.add(column.getFamily(), column.getQualifier(), column.getValue());
  }

  if (append.isSetAttributes()) {
    addAttributes(out, append.getAttributes());
  }

  if (append.isSetDurability()) {
    out.setDurability(durabilityFromThrift(append.getDurability()));
  }
  
  if(append.getCellVisibility() != null) {
    out.setCellVisibility(new CellVisibility(append.getCellVisibility().getExpression()));
  }

  return out;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:ThriftUtilities.java

示例2: appendFromThrift

import org.apache.hadoop.hbase.client.Append; //导入方法依赖的package包/类
/**
 * From a {@link TAppend} create an {@link Append}.
 * @param tappend the Thrift version of an append.
 * @return an increment that the {@link TAppend} represented.
 */
public static Append appendFromThrift(TAppend tappend) {
  Append append = new Append(tappend.getRow());
  List<ByteBuffer> columns = tappend.getColumns();
  List<ByteBuffer> values = tappend.getValues();

  if (columns.size() != values.size()) {
    throw new IllegalArgumentException(
        "Sizes of columns and values in tappend object are not matching");
  }

  int length = columns.size();

  for (int i = 0; i < length; i++) {
    byte[][] famAndQf = KeyValue.parseColumn(getBytes(columns.get(i)));
    append.add(famAndQf[0], famAndQf[1], getBytes(values.get(i)));
  }
  return append;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:ThriftUtilities.java

示例3: testAppend

import org.apache.hadoop.hbase.client.Append; //导入方法依赖的package包/类
@Test (timeout=180000)
public void testAppend() throws Exception {

  AccessTestAction appendAction = new AccessTestAction() {
    @Override
    public Object run() throws Exception {
      byte[] row = TEST_ROW;
      byte[] qualifier = TEST_QUALIFIER;
      Put put = new Put(row);
      put.add(TEST_FAMILY, qualifier, Bytes.toBytes(1));
      Append append = new Append(row);
      append.add(TEST_FAMILY, qualifier, Bytes.toBytes(2));
      try(Connection conn = ConnectionFactory.createConnection(conf);
          Table t = conn.getTable(TEST_TABLE)) {
        t.put(put);
        t.append(append);
      }
      return null;
    }
  };

  verifyAllowed(appendAction, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE, USER_RW,
    USER_GROUP_WRITE);
  verifyDenied(appendAction, USER_RO, USER_NONE, USER_GROUP_CREATE, USER_GROUP_READ,
    USER_GROUP_ADMIN);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:TestAccessController.java

示例4: testAppendHook

import org.apache.hadoop.hbase.client.Append; //导入方法依赖的package包/类
@Test (timeout=300000)
public void testAppendHook() throws IOException {
  TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + ".testAppendHook");
  Table table = util.createTable(tableName, new byte[][] {A, B, C});
  try {
    Append app = new Append(Bytes.toBytes(0));
    app.add(A, A, A);

    verifyMethodResult(SimpleRegionObserver.class,
        new String[] {"hadPreAppend", "hadPostAppend", "hadPreAppendAfterRowLock"},
        tableName,
        new Boolean[] {false, false, false}
        );

    table.append(app);

    verifyMethodResult(SimpleRegionObserver.class,
        new String[] {"hadPreAppend", "hadPostAppend", "hadPreAppendAfterRowLock"},
        tableName,
        new Boolean[] {true, true, true}
        );
  } finally {
    util.deleteTable(tableName);
    table.close();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:TestRegionObserverInterface.java

示例5: testAppendWithReadOnlyTable

import org.apache.hadoop.hbase.client.Append; //导入方法依赖的package包/类
@Test
public void testAppendWithReadOnlyTable() throws Exception {
  byte[] TABLE = Bytes.toBytes("readOnlyTable");
  this.region = initHRegion(TABLE, getName(), CONF, true, Bytes.toBytes("somefamily"));
  boolean exceptionCaught = false;
  Append append = new Append(Bytes.toBytes("somerow"));
  append.setDurability(Durability.SKIP_WAL);
  append.add(Bytes.toBytes("somefamily"), Bytes.toBytes("somequalifier"),
      Bytes.toBytes("somevalue"));
  try {
    region.append(append);
  } catch (IOException e) {
    exceptionCaught = true;
  } finally {
    HRegion.closeHRegion(this.region);
    this.region = null;
  }
  assertTrue(exceptionCaught == true);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:TestHRegion.java

示例6: testAppendWithReadOnlyTable

import org.apache.hadoop.hbase.client.Append; //导入方法依赖的package包/类
public void testAppendWithReadOnlyTable() throws Exception {
  byte[] TABLE = Bytes.toBytes("readOnlyTable");
  this.region = initHRegion(TABLE, getName(), conf, true, Bytes.toBytes("somefamily"));
  boolean exceptionCaught = false;
  Append append = new Append(Bytes.toBytes("somerow"));
  append.add(Bytes.toBytes("somefamily"), Bytes.toBytes("somequalifier"), 
      Bytes.toBytes("somevalue"));
  try {
    region.append(append, false);
  } catch (IOException e) {
    exceptionCaught = true;
  } finally {
    HRegion.closeHRegion(this.region);
    this.region = null;
  }
  assertTrue(exceptionCaught == true);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:18,代码来源:TestHRegion.java

示例7: testAppend

import org.apache.hadoop.hbase.client.Append; //导入方法依赖的package包/类
@Test
public void testAppend() throws Exception {

  AccessTestAction appendAction = new AccessTestAction() {
    @Override
    public Object run() throws Exception {
      byte[] row = TEST_ROW;
      byte[] qualifier = TEST_QUALIFIER;
      Put put = new Put(row);
      put.add(TEST_FAMILY, qualifier, Bytes.toBytes(1));
      Append append = new Append(row);
      append.add(TEST_FAMILY, qualifier, Bytes.toBytes(2));
      Table t = new HTable(conf, TEST_TABLE.getTableName());
      try {
        t.put(put);
        t.append(append);
      } finally {
        t.close();
      }
      return null;
    }
  };

  verifyAllowed(appendAction, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE, USER_RW);
  verifyDenied(appendAction, USER_RO, USER_NONE);
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:27,代码来源:TestAccessController.java

示例8: testAppend

import org.apache.hadoop.hbase.client.Append; //导入方法依赖的package包/类
@Test
public void testAppend() throws Exception {

  AccessTestAction appendAction = new AccessTestAction() {
    @Override
    public Object run() throws Exception {
      byte[] row = TEST_ROW;
      byte[] qualifier = TEST_QUALIFIER;
      Put put = new Put(row);
      put.add(TEST_FAMILY, qualifier, Bytes.toBytes(1));
      Append append = new Append(row);
      append.add(TEST_FAMILY, qualifier, Bytes.toBytes(2));
      HTable t = new HTable(conf, TEST_TABLE.getTableName());
      try {
        t.put(put);
        t.append(append);
      } finally {
        t.close();
      }
      return null;
    }
  };

  verifyAllowed(appendAction, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE, USER_RW);
  verifyDenied(appendAction, USER_RO, USER_NONE);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:27,代码来源:TestAccessController.java

示例9: testAppend

import org.apache.hadoop.hbase.client.Append; //导入方法依赖的package包/类
@Test
public void testAppend() throws Exception {

  PrivilegedExceptionAction appendAction = new PrivilegedExceptionAction() {
    public Object run() throws Exception {
      byte[] row = Bytes.toBytes("random_row");
      byte[] qualifier = Bytes.toBytes("q");
      Put put = new Put(row);
      put.add(TEST_FAMILY, qualifier, Bytes.toBytes(1));
      Append append = new Append(row);
      append.add(TEST_FAMILY, qualifier, Bytes.toBytes(2));
      HTable t = new HTable(conf, TEST_TABLE);
      try {
        t.put(put);
        t.append(append);
      } finally {
        t.close();
      }
      return null;
    }
  };

  verifyAllowed(appendAction, SUPERUSER, USER_ADMIN, USER_OWNER, USER_RW);
  verifyDenied(appendAction, USER_CREATE, USER_RO, USER_NONE);
}
 
开发者ID:wanhao,项目名称:IRIndex,代码行数:26,代码来源:TestAccessController.java

示例10: testAppend

import org.apache.hadoop.hbase.client.Append; //导入方法依赖的package包/类
@Test
public void testAppend() throws Exception {

  PrivilegedExceptionAction appendAction = new PrivilegedExceptionAction() {
    @Override
    public Object run() throws Exception {
      byte[] row = Bytes.toBytes("random_row");
      byte[] qualifier = Bytes.toBytes("q");
      Put put = new Put(row);
      put.add(TEST_FAMILY, qualifier, Bytes.toBytes(1));
      Append append = new Append(row);
      append.add(TEST_FAMILY, qualifier, Bytes.toBytes(2));
      HTable t = new HTable(conf, TEST_TABLE.getTableName());
      try {
        t.put(put);
        t.append(append);
      } finally {
        t.close();
      }
      return null;
    }
  };

  verifyAllowed(appendAction, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE, USER_RW);
  verifyDenied(appendAction, USER_RO, USER_NONE);
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:27,代码来源:TestAccessController.java

示例11: testAppendWithReadOnlyTable

import org.apache.hadoop.hbase.client.Append; //导入方法依赖的package包/类
@Test
public void testAppendWithReadOnlyTable() throws Exception {
  byte[] TABLE = Bytes.toBytes("readOnlyTable");
  this.region = initHRegion(TABLE, getName(), conf, true, Bytes.toBytes("somefamily"));
  boolean exceptionCaught = false;
  Append append = new Append(Bytes.toBytes("somerow"));
  append.setDurability(Durability.SKIP_WAL);
  append.add(Bytes.toBytes("somefamily"), Bytes.toBytes("somequalifier"),
      Bytes.toBytes("somevalue"));
  try {
    region.append(append);
  } catch (IOException e) {
    exceptionCaught = true;
  } finally {
    HRegion.closeHRegion(this.region);
    this.region = null;
  }
  assertTrue(exceptionCaught == true);
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:20,代码来源:TestHRegion.java

示例12: testRow

import org.apache.hadoop.hbase.client.Append; //导入方法依赖的package包/类
@Override
void testRow(final int i) throws IOException {
  byte [] bytes = format(i);
  Append append = new Append(bytes);
  append.add(FAMILY_NAME, getQualifier(), bytes);
  updateValueSize(this.table.append(append));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:PerformanceEvaluation.java

示例13: run

import org.apache.hadoop.hbase.client.Append; //导入方法依赖的package包/类
@Override
public void run() {
  int count = 0;
  while (count < appendCounter) {
    Append app = new Append(appendRow);
    app.add(family, qualifier, CHAR);
    count++;
    try {
      region.append(app);
    } catch (IOException e) {
      e.printStackTrace();
      break;
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:TestHRegion.java

示例14: testAppendTimestampsAreMonotonic

import org.apache.hadoop.hbase.client.Append; //导入方法依赖的package包/类
@Test
public void testAppendTimestampsAreMonotonic() throws IOException {
  HRegion region = initHRegion(tableName, name.getMethodName(), CONF, fam1);
  ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
  EnvironmentEdgeManager.injectEdge(edge);

  edge.setValue(10);
  Append a = new Append(row);
  a.setDurability(Durability.SKIP_WAL);
  a.add(fam1, qual1, qual1);
  region.append(a);

  Result result = region.get(new Get(row));
  Cell c = result.getColumnLatestCell(fam1, qual1);
  assertNotNull(c);
  assertEquals(c.getTimestamp(), 10L);

  edge.setValue(1); // clock goes back
  region.append(a);
  result = region.get(new Get(row));
  c = result.getColumnLatestCell(fam1, qual1);
  assertEquals(c.getTimestamp(), 10L);

  byte[] expected = new byte[qual1.length*2];
  System.arraycopy(qual1, 0, expected, 0, qual1.length);
  System.arraycopy(qual1, 0, expected, qual1.length, qual1.length);

  assertTrue(Bytes.equals(c.getValueArray(), c.getValueOffset(), c.getValueLength(),
    expected, 0, expected.length));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:31,代码来源:TestHRegion.java

示例15: run

import org.apache.hadoop.hbase.client.Append; //导入方法依赖的package包/类
@Override
public void run() {
  int count = 0;
  while (count < appendCounter) {
    Append app = new Append(appendRow);
    app.add(family, qualifier, CHAR);
    count++;
    try {
      region.append(app, null, true);
    } catch (IOException e) {
      e.printStackTrace();
      break;
    }
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:16,代码来源:TestHRegion.java


注:本文中的org.apache.hadoop.hbase.client.Append.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。