本文整理了Java中org.apache.hadoop.hbase.client.Table.put()
方法的一些代码示例,展示了Table.put()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.put()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Table
类名称:Table
方法名:put
[英]Puts some data in the table, in batch.
This can be used for group commit, or for submitting user defined batches. The writeBuffer will be periodically inspected while the List is processed, so depending on the List size the writeBuffer may flush not at all, or more than once.
[中]将一些数据批量放入表中。
这可以用于组提交,也可以用于提交用户定义的批。在处理列表时,将定期检查writeBuffer,因此根据列表大小,writeBuffer可能根本不会刷新,或多次刷新。
代码示例来源:origin: apache/hbase
private void loadData(Table t, byte[] family, byte[] column) throws IOException {
for (int i = 0; i < 10; i++) {
byte[] row = Bytes.toBytes("row" + i);
Put p = new Put(row);
p.addColumn(family, column, row);
t.put(p);
}
}
代码示例来源:origin: apache/hbase
/**
* Tests that a put on a table throws {@link SocketTimeoutException} when the operation takes
* longer than 'hbase.client.operation.timeout'.
*/
@Test(expected = SocketTimeoutException.class)
public void testPutTimeout() throws Exception {
DELAY_MUTATE = 600;
Put put = new Put(ROW);
put.addColumn(FAMILY, QUALIFIER, VALUE);
table.put(put);
}
代码示例来源:origin: apache/hbase
private void put(int start, int end, long ts) throws IOException {
for (int i = start; i < end; i++) {
TABLE.put(new Put(Bytes.toBytes(i)).addColumn(FAMILY, QUALIFIER, ts, Bytes.toBytes(i)));
}
}
代码示例来源:origin: apache/hbase
@Test(expected = DoNotRetryIOException.class)
public void testPutWithDoNotRetryIOException() throws Exception {
tableDoNotRetry.put(new Put(Bytes.toBytes("row")).addColumn(CF, CQ, Bytes.toBytes("value")));
}
代码示例来源:origin: apache/hbase
@Test(expected = RetriesExhaustedException.class)
public void testPutWithIOException() throws Exception {
tableRetry.put(new Put(Bytes.toBytes("row")).addColumn(CF, CQ, Bytes.toBytes("value")));
}
代码示例来源:origin: apache/hbase
protected void doPut(Table table, int i) throws IOException {
Put put = new Put(Bytes.toBytes("row" + String.format("%1$04d", i)));
put.addColumn(HConstants.CATALOG_FAMILY, null, value);
table.put(put);
}
代码示例来源:origin: apache/hbase
public void loadNumericRows(final Table t, final byte[] f, int startRow, int endRow)
throws IOException {
for (int i = startRow; i < endRow; i++) {
byte[] data = Bytes.toBytes(String.valueOf(i));
Put put = new Put(data);
put.addColumn(f, null, data);
t.put(put);
}
}
代码示例来源:origin: apache/hbase
@Override
public Object run() throws Exception {
Put put = new Put(Bytes.toBytes("test"));
put.addColumn(TEST_FAMILY, Bytes.toBytes("qual"), Bytes.toBytes("value"));
table.put(put);
return null;
}
};
代码示例来源:origin: apache/hbase
private void writeData(Table t) throws IOException {
List<Put> puts = new ArrayList<>(NUM_ROWS);
for (int i = 0; i < NUM_ROWS; i++) {
Put p = new Put(Bytes.toBytes(i + 1));
p.addColumn(FAMILY, QUALIFIER, Bytes.toBytes(value));
puts.add(p);
}
t.put(puts);
}
代码示例来源:origin: apache/hbase
private void writeData(Table t) throws IOException {
List<Put> puts = new ArrayList<>(NUM_ROWS);
for (int i = 0; i < NUM_ROWS; i++) {
Put p = new Put(Bytes.toBytes(i + 1));
p.addColumn(FAMILY, EXPLICIT_QUAL, EXPLICIT_VAL);
p.addColumn(FAMILY, IMPLICIT_QUAL, IMPLICIT_VAL);
puts.add(p);
}
t.put(puts);
}
代码示例来源:origin: apache/hbase
void addData(int start) throws IOException {
List<Put> puts = new ArrayList<>();
for (int i=start; i< start + 100; i++) {
Put put = new Put(Bytes.toBytes(i));
put.addColumn(family, family, Bytes.toBytes(i));
puts.add(put);
}
table.put(puts);
}
}
代码示例来源:origin: apache/hbase
protected static void loadData(String prefix, byte[] row) throws IOException {
List<Put> puts = new ArrayList<>(NB_ROWS_IN_BATCH);
for (int i = 0; i < NB_ROWS_IN_BATCH; i++) {
Put put = new Put(Bytes.toBytes(prefix + Integer.toString(i)));
put.addColumn(famName, row, row);
puts.add(put);
}
htable1.put(puts);
}
代码示例来源:origin: apache/hbase
private void writeData(Table t) throws IOException {
List<Put> puts = new ArrayList<>(NUM_ROWS);
for (int i = 0; i < NUM_ROWS; i++) {
Put p = new Put(Bytes.toBytes(i + 1));
p.addColumn(FAMILY, QUALIFIER, Bytes.toBytes(value));
puts.add(p);
}
t.put(puts);
}
代码示例来源:origin: apache/hbase
private void randomCFPuts(Table table, byte[] row, byte[] family, int nPuts)
throws Exception {
Put put = new Put(row);
for (int i = 0; i < nPuts; i++) {
byte[] qualifier = Bytes.toBytes(random.nextInt());
byte[] value = Bytes.toBytes(random.nextInt());
put.addColumn(family, qualifier, value);
}
table.put(put);
}
代码示例来源:origin: apache/hbase
@Before
public void before() throws Exception {
table = util.createTable(TEST_TABLE, TEST_FAMILY);
Put puta = new Put(ROW_A);
puta.addColumn(TEST_FAMILY, qualifierCol1, bytes1);
table.put(puta);
Put putb = new Put(ROW_B);
putb.addColumn(TEST_FAMILY, qualifierCol1, bytes2);
table.put(putb);
Put putc = new Put(ROW_C);
putc.addColumn(TEST_FAMILY, qualifierCol1, bytes3);
table.put(putc);
}
代码示例来源:origin: apache/hbase
private void putOneRow(Table table) throws IOException {
Put put = new Put(ROWKEY);
put.addColumn(FAMILY, Bytes.toBytes("A"), Bytes.toBytes("a"));
put.addColumn(FAMILY, Bytes.toBytes("B"), Bytes.toBytes("b"));
put.addColumn(FAMILY, Bytes.toBytes("C"), Bytes.toBytes("c"));
table.put(put);
}
代码示例来源:origin: apache/hbase
@Before
public void before() throws Exception {
final byte[][] SPLIT_KEYS = new byte[][] { ROW_B, ROW_C };
Table table = util.createTable(TEST_TABLE, TEST_FAMILY, SPLIT_KEYS);
Put puta = new Put(ROW_A);
puta.addColumn(TEST_FAMILY, Bytes.toBytes("col1"), Bytes.toBytes(1));
table.put(puta);
Put putb = new Put(ROW_B);
putb.addColumn(TEST_FAMILY, Bytes.toBytes("col1"), Bytes.toBytes(1));
table.put(putb);
Put putc = new Put(ROW_C);
putc.addColumn(TEST_FAMILY, Bytes.toBytes("col1"), Bytes.toBytes(1));
table.put(putc);
}
代码示例来源:origin: apache/hbase
public void loadTable(final Table table, int numRows) throws IOException {
List<Put> puts = new ArrayList<>(numRows);
for (int i = 0; i < numRows; ++i) {
byte[] row = Bytes.toBytes(String.format("%09d", i));
Put put = new Put(row);
put.setDurability(Durability.SKIP_WAL);
put.addColumn(FAMILY_NAME, null, row);
table.put(put);
}
}
代码示例来源:origin: apache/hbase
private void generateRows(int numberOfRows, Table ht, byte[] family, byte[] qf, byte[] value)
throws IOException {
for (int i = 0; i < numberOfRows; i++) {
byte[] row = Bytes.toBytes(i);
Put p = new Put(row);
p.addColumn(family, qf, value);
ht.put(p);
}
TEST_UTIL.flush();
}
代码示例来源:origin: apache/hbase
protected static void loadTable(Table table) throws Exception {
Put p; // 100 + 1 row to t1_syncup
for (int i = 0; i < NB_ROWS_IN_BATCH; i++) {
p = new Put(Bytes.toBytes("row" + i));
p.setDurability(Durability.SKIP_WAL);
p.addColumn(famName, qualName, Bytes.toBytes("val" + i));
table.put(p);
}
}
内容来源于网络,如有侵权,请联系作者删除!