本文整理了Java中org.apache.hadoop.hbase.client.Table.existsAll()
方法的一些代码示例,展示了Table.existsAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.existsAll()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Table
类名称:Table
方法名:existsAll
[英]Test for the existence of columns in the table, as specified by the Gets.
This will return an array of booleans. Each value will be true if the related Get matches one or more keys, false if not.
This is a server-side call so it prevents any data from being transferred to the client.
[中]测试表中是否存在Gets指定的列。
这将返回一系列布尔值。如果相关Get匹配一个或多个键,则每个值都将为true,否则为false。
这是一个服务器端调用,因此它可以防止任何数据传输到客户端。
代码示例来源:origin: apache/hbase
@Override
public List<Boolean> existsAll(ByteBuffer table, List<TGet> gets) throws TIOError, TException {
Table htable = getTable(table);
try {
boolean[] exists = htable.existsAll(getsFromThrift(gets));
List<Boolean> result = new ArrayList<>(exists.length);
for (boolean exist : exists) {
result.add(exist);
}
return result;
} catch (IOException e) {
throw getTIOError(e);
} finally {
closeTable(htable);
}
}
代码示例来源:origin: apache/hbase
boolean[] results = table.existsAll(gets);
assertFalse(results[0]);
assertFalse(results[1]);
gets.add(new Get(new byte[] { 0x00 }));
gets.add(new Get(new byte[] { 0x00, 0x00 }));
results = table.existsAll(gets);
assertTrue(results[0]);
assertFalse(results[1]);
gets.add(new Get(new byte[] { (byte) 0xff, (byte) 0xff }));
gets.add(new Get(new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff }));
results = table.existsAll(gets);
assertFalse(results[0]);
assertTrue(results[1]);
代码示例来源:origin: apache/phoenix
@Override
public boolean[] exists(List<Get> gets) throws IOException {
return delegate.existsAll(gets);
}
代码示例来源:origin: apache/phoenix
@Override
public boolean[] existsAll(List<Get> gets) throws IOException {
return delegate.existsAll(gets);
}
代码示例来源:origin: apache/hbase
@Test
public void testHTableExistsAllBeforeGet() throws Exception {
final byte[] ROW2 = Bytes.add(ROW, Bytes.toBytes("2"));
Table table = TEST_UTIL.createTable(
TableName.valueOf(name.getMethodName()), new byte[][] { FAMILY });
try {
Put put = new Put(ROW);
put.addColumn(FAMILY, QUALIFIER, VALUE);
table.put(put);
put = new Put(ROW2);
put.addColumn(FAMILY, QUALIFIER, VALUE);
table.put(put);
Get get = new Get(ROW);
Get get2 = new Get(ROW2);
ArrayList<Get> getList = new ArrayList(2);
getList.add(get);
getList.add(get2);
boolean[] exists = table.existsAll(getList);
assertEquals(true, exists[0]);
assertEquals(true, exists[1]);
Result[] result = table.get(getList);
assertEquals(false, result[0].isEmpty());
assertTrue(Bytes.equals(VALUE, result[0].getValue(FAMILY, QUALIFIER)));
assertEquals(false, result[1].isEmpty());
assertTrue(Bytes.equals(VALUE, result[1].getValue(FAMILY, QUALIFIER)));
} finally {
table.close();
}
}
代码示例来源:origin: apache/hbase
public void testCheckAndDelete(Connection connection, String tableName) throws IOException {
createTable(thriftAdmin, tableName);
try (Table table = connection.getTable(TableName.valueOf(tableName))){
Get get = new Get(ROW_1);
Result result = table.get(get);
byte[] value1 = result.getValue(FAMILYA, QUALIFIER_1);
byte[] value2 = result.getValue(FAMILYB, QUALIFIER_2);
assertNotNull(value1);
assertTrue(Bytes.equals(VALUE_1, value1));
assertNull(value2);
assertTrue(table.exists(get));
assertEquals(1, table.existsAll(Collections.singletonList(get)).length);
Delete delete = new Delete(ROW_1);
table.checkAndMutate(ROW_1, FAMILYA).qualifier(QUALIFIER_1)
.ifEquals(VALUE_1).thenDelete(delete);
assertFalse(table.exists(get));
Put put = new Put(ROW_1);
put.addColumn(FAMILYA, QUALIFIER_1, VALUE_1);
table.put(put);
assertTrue(table.checkAndMutate(ROW_1, FAMILYA).qualifier(QUALIFIER_1)
.ifEquals(VALUE_1).thenPut(put));
assertFalse(table.checkAndMutate(ROW_1, FAMILYA).qualifier(QUALIFIER_1)
.ifEquals(VALUE_2).thenPut(put));
}
}
代码示例来源:origin: org.apache.phoenix/phoenix-core
@Override
public boolean[] exists(List<Get> gets) throws IOException {
return delegate.existsAll(gets);
}
代码示例来源:origin: org.apache.phoenix/phoenix-core
@Override
public boolean[] existsAll(List<Get> gets) throws IOException {
return delegate.existsAll(gets);
}
代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core
@Override
public boolean[] existsAll(List<Get> gets) throws IOException {
return delegate.existsAll(gets);
}
代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core
@Override
public boolean[] exists(List<Get> gets) throws IOException {
return delegate.existsAll(gets);
}
代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.1
@Override
public boolean[] existsAll(List<Get> gets) throws IOException {
if (tx == null) {
throw new IOException("Transaction not started");
}
List<Get> transactionalizedGets = new ArrayList<>(gets.size());
for (Get get : gets) {
transactionalizedGets.add(transactionalizeAction(get));
}
return hTable.existsAll(transactionalizedGets);
}
代码示例来源:origin: apache/gora
public boolean[] existsAll(List<Get> list) throws IOException {
return getTable().existsAll(list);
}
代码示例来源:origin: org.apache.hbase/hbase-thrift
@Override
public List<Boolean> existsAll(ByteBuffer table, List<TGet> gets) throws TIOError, TException {
Table htable = getTable(table);
try {
boolean[] exists = htable.existsAll(getsFromThrift(gets));
List<Boolean> result = new ArrayList<>(exists.length);
for (boolean exist : exists) {
result.add(exist);
}
return result;
} catch (IOException e) {
throw getTIOError(e);
} finally {
closeTable(htable);
}
}
代码示例来源:origin: com.aliyun.hbase/alihbase-thrift
@Override
public List<Boolean> existsAll(ByteBuffer table, List<TGet> gets) throws TIOError, TException {
Table htable = getTable(table);
try {
boolean[] exists = htable.existsAll(getsFromThrift(gets));
List<Boolean> result = new ArrayList<>(exists.length);
for (boolean exist : exists) {
result.add(exist);
}
return result;
} catch (IOException e) {
throw getTIOError(e);
} finally {
closeTable(htable);
}
}
代码示例来源:origin: org.apache.hbase/hbase-server
boolean[] results = table.existsAll(gets);
assertFalse(results[0]);
assertFalse(results[1]);
gets.add(new Get(new byte[] { 0x00 }));
gets.add(new Get(new byte[] { 0x00, 0x00 }));
results = table.existsAll(gets);
assertTrue(results[0]);
assertFalse(results[1]);
gets.add(new Get(new byte[] { (byte) 0xff, (byte) 0xff }));
gets.add(new Get(new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff }));
results = table.existsAll(gets);
assertFalse(results[0]);
assertTrue(results[1]);
代码示例来源:origin: GoogleCloudPlatform/cloud-bigtable-client
boolean[] checks = table.existsAll(gets);
for (Boolean check : checks) {
Assert.assertFalse(check);
代码示例来源:origin: org.apache.hbase/hbase-server
@Test
public void testHTableExistsAllBeforeGet() throws Exception {
final byte[] ROW2 = Bytes.add(ROW, Bytes.toBytes("2"));
Table table = TEST_UTIL.createTable(
TableName.valueOf(name.getMethodName()), new byte[][] { FAMILY });
try {
Put put = new Put(ROW);
put.addColumn(FAMILY, QUALIFIER, VALUE);
table.put(put);
put = new Put(ROW2);
put.addColumn(FAMILY, QUALIFIER, VALUE);
table.put(put);
Get get = new Get(ROW);
Get get2 = new Get(ROW2);
ArrayList<Get> getList = new ArrayList(2);
getList.add(get);
getList.add(get2);
boolean[] exists = table.existsAll(getList);
assertEquals(true, exists[0]);
assertEquals(true, exists[1]);
Result[] result = table.get(getList);
assertEquals(false, result[0].isEmpty());
assertTrue(Bytes.equals(VALUE, result[0].getValue(FAMILY, QUALIFIER)));
assertEquals(false, result[1].isEmpty());
assertTrue(Bytes.equals(VALUE, result[1].getValue(FAMILY, QUALIFIER)));
} finally {
table.close();
}
}
内容来源于网络,如有侵权,请联系作者删除!