本文整理了Java中org.apache.hadoop.hbase.client.Get.<init>()
方法的一些代码示例,展示了Get.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Get.<init>()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Get
类名称:Get
方法名:<init>
[英]Constructor for Writable. DO NOT USE
[中]可写的构造函数。不要使用
代码示例来源:origin: apache/hbase
public static Get makeGetForUserQuotas(final String user, final Iterable<TableName> tables,
final Iterable<String> namespaces) {
Get get = new Get(getUserRowKey(user));
get.addColumn(QUOTA_FAMILY_INFO, QUOTA_QUALIFIER_SETTINGS);
for (final TableName table: tables) {
get.addColumn(QUOTA_FAMILY_INFO, getSettingsQualifierForUserTable(table));
}
for (final String ns: namespaces) {
get.addColumn(QUOTA_FAMILY_INFO, getSettingsQualifierForUserNamespace(ns));
}
return get;
}
代码示例来源:origin: apache/hbase
/**
* Tests that a get on a table throws {@link SocketTimeoutException} when the operation takes
* longer than 'hbase.client.operation.timeout'.
*/
@Test(expected = SocketTimeoutException.class)
public void testGetTimeout() throws Exception {
DELAY_GET = 600;
table.get(new Get(ROW));
}
代码示例来源:origin: apache/hbase
protected CINode getNode(byte[] row, Table table, CINode node) throws IOException {
Get get = new Get(row);
get.addColumn(FAMILY_NAME, COLUMN_PREV);
Result result = table.get(get);
return getCINode(result, node);
}
}
代码示例来源:origin: apache/hbase
private void assertValueEquals(int start, int end) throws IOException {
for (int i = start; i < end; i++) {
assertEquals(i,
Bytes.toInt(TABLE.get(new Get(Bytes.toBytes(i))).getValue(FAMILY, QUALIFIER)));
}
}
代码示例来源:origin: apache/hbase
@Test
public void testPutMaskedAndUserMaxVersion() throws IOException {
try (Table t = createTable()) {
t.put(new Put(ROW).addColumn(FAMILY, col1, 1000001, value));
t.put(new Put(ROW).addColumn(FAMILY, col1, 1000002, value));
t.put(new Put(ROW).addColumn(FAMILY, col1, 1000003, value));
t.put(new Put(ROW).addColumn(FAMILY, col1, 1000004, value));
t.delete(new Delete(ROW).addColumn(FAMILY, col1, 1000004));
t.delete(new Delete(ROW).addColumn(FAMILY, col1, 1000003));
Result r = t.get(new Get(ROW).setMaxVersions(1));
assertEquals(1, r.size());
assertEquals(1000002, r.rawCells()[0].getTimestamp());
TEST_UTIL.getAdmin().flush(t.getName());
r = t.get(new Get(ROW).setMaxVersions(1));
assertEquals(1, r.size());
assertEquals(1000002, r.rawCells()[0].getTimestamp());
}
}
代码示例来源:origin: apache/hbase
@Test
public void testIncrement() throws InterruptedException, ExecutionException {
AsyncTable<?> table = ASYNC_CONN.getTable(TABLE_NAME);
assertEquals(1L, table.incrementColumnValue(row, FAMILY, QUALIFIER, 1L).get().longValue());
// the second call should have no effect as we always generate the same nonce.
assertEquals(1L, table.incrementColumnValue(row, FAMILY, QUALIFIER, 1L).get().longValue());
Result result = table.get(new Get(row)).get();
assertEquals(1L, Bytes.toLong(result.getValue(FAMILY, QUALIFIER)));
}
}
代码示例来源:origin: apache/hbase
@Test
public void testGetRowConstructor() {
byte[] row1 = Bytes.toBytes("testRow");
byte[] row2 = Bytes.toBytes("testtestRow");
ByteBuffer rowBuffer = ByteBuffer.allocate(16);
rowBuffer = ByteBuffer.wrap(row1);
Get get1 = new Get(rowBuffer);
Get get2 = new Get(row2, 4, 7);
Assert.assertArrayEquals(get1.getRow(), get2.getRow());
}
}
代码示例来源:origin: apache/hbase
@Test(expected = RetriesExhaustedException.class)
public void testGetWithIOException() throws Exception {
tableRetry.get(new Get(Bytes.toBytes("row")).addColumn(CF, CQ));
}
代码示例来源:origin: apache/hbase
private void run(AtomicBoolean stop) throws InterruptedException, ExecutionException {
while (!stop.get()) {
for (int i = 0; i < COUNT; i++) {
assertEquals(i, Bytes.toInt(TABLE.get(new Get(Bytes.toBytes(String.format("%03d", i))))
.get().getValue(FAMILY, QUALIFIER)));
}
}
}
代码示例来源:origin: apache/hbase
protected final void assertSum() throws IOException {
Result result = TABLE.get(new Get(ROW).addColumn(FAMILY, CQ1).addColumn(FAMILY, CQ2));
assertEquals(THREADS * (1 + UPPER) * UPPER / 2, Bytes.toLong(result.getValue(FAMILY, CQ1)));
assertEquals(THREADS * (1 + UPPER) * UPPER, Bytes.toLong(result.getValue(FAMILY, CQ2)));
}
代码示例来源:origin: apache/hbase
private static void assertGet(final HRegion region, byte [] row, byte [] familiy,
byte[] qualifier, byte[] value) throws IOException {
// run a get and see if the value matches
Get get = new Get(row);
get.addColumn(familiy, qualifier);
Result result = region.get(get);
assertEquals(1, result.size());
Cell kv = result.rawCells()[0];
byte[] r = CellUtil.cloneValue(kv);
assertTrue(Bytes.compareTo(r, value) == 0);
}
代码示例来源:origin: apache/hbase
private void getOneRowAndAssertAllExist(final Table table) throws IOException {
Get get = new Get(ROWKEY);
Result result = table.get(get);
assertTrue("Column A value should be a",
Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("A"))).equals("a"));
assertTrue("Column B value should be b",
Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("B"))).equals("b"));
assertTrue("Column C value should be c",
Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("C"))).equals("c"));
}
代码示例来源:origin: apache/hbase
protected final void verifyNotReplicatedThroughRegion(HBaseTestingUtility util, int start,
int end) throws IOException {
HRegion region = util.getMiniHBaseCluster().getRegions(TABLE_NAME).get(0);
for (int i = start; i < end; i++) {
assertTrue(region.get(new Get(Bytes.toBytes(i))).isEmpty());
}
}
代码示例来源:origin: apache/hbase
@Test
public void testNullQualifier() {
Get get = new Get(ROW);
byte[] family = Bytes.toBytes("family");
get.addColumn(family, null);
Set<byte[]> qualifiers = get.getFamilyMap().get(family);
Assert.assertEquals(1, qualifiers.size());
}
代码示例来源:origin: apache/hbase
@Test
public void testPutAndDeleteVersions() throws IOException {
try (Table t = createTable()) {
t.put(new Put(ROW).addColumn(FAMILY, col1, 1000001, value));
t.put(new Put(ROW).addColumn(FAMILY, col1, 1000002, value));
t.put(new Put(ROW).addColumn(FAMILY, col1, 1000003, value));
t.put(new Put(ROW).addColumn(FAMILY, col1, 1000004, value));
t.delete(new Delete(ROW).addColumns(FAMILY, col1, 2000000));
t.put(new Put(ROW).addColumn(FAMILY, col1, 1000000, value));
TEST_UTIL.getAdmin().flush(t.getName());
Result r = t.get(new Get(ROW).setMaxVersions(3));
assertEquals(1, r.size());
assertEquals(1000000, r.rawCells()[0].getTimestamp());
}
}
代码示例来源:origin: apache/hbase
@Test
public void testGetId() {
Get get = new Get(ROW);
Assert.assertNull("Make sure id is null if unset", get.toMap().get("id"));
get.setId("myId");
Assert.assertEquals("myId", get.toMap().get("id"));
}
代码示例来源:origin: apache/hbase
@Test
public void testGet_Empty() throws IOException {
byte[] row = Bytes.toBytes("row");
byte[] fam = Bytes.toBytes("fam");
this.region = initHRegion(tableName, method, CONF, fam);
Get get = new Get(row);
get.addFamily(fam);
Result r = region.get(get);
assertTrue(r.isEmpty());
}
代码示例来源:origin: apache/hbase
@Test
public void testGetNoResultNoStaleRegionWithReplica() throws Exception {
byte[] b1 = "testGetNoResultNoStaleRegionWithReplica".getBytes();
openRegion(hriSecondary);
try {
// A get works and is not stale
Get g = new Get(b1);
Result r = table.get(g);
Assert.assertFalse(r.isStale());
} finally {
closeRegion(hriSecondary);
}
}
代码示例来源:origin: apache/hbase
@Test(expected = DoNotRetryIOException.class)
public void testGetWithDoNotRetryIOException() throws Exception {
tableDoNotRetry.get(new Get(Bytes.toBytes("row")).addColumn(CF, CQ));
}
代码示例来源:origin: apache/hbase
protected final void verifyThroughRegion(HBaseTestingUtility util, int start, int end)
throws IOException {
HRegion region = util.getMiniHBaseCluster().getRegions(TABLE_NAME).get(0);
for (int i = start; i < end; i++) {
assertEquals(i, Bytes.toInt(region.get(new Get(Bytes.toBytes(i))).getValue(CF, CQ)));
}
}
内容来源于网络,如有侵权,请联系作者删除!