本文整理汇总了Java中org.apache.hadoop.hbase.client.Query类的典型用法代码示例。如果您正苦于以下问题:Java Query类的具体用法?Java Query怎么用?Java Query使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Query类属于org.apache.hadoop.hbase.client包,在下文中一共展示了Query类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: convertToQuery
import org.apache.hadoop.hbase.client.Query; //导入依赖的package包/类
@Override
public Query convertToQuery(Row row) {
if (filtersEntireRowKey(row)) {
return convertToGet(row);
}
else if (filtersRowKeyPrefix(row)) {
return convertToScan(row);
}
else {
throw new RuntimeException("Default HBase serde only supports full row key or prefix row key reads.");
}
}
开发者ID:cloudera-labs,项目名称:envelope,代码行数:13,代码来源:DefaultHBaseSerde.java
示例2: getExistingForFilters
import org.apache.hadoop.hbase.client.Query; //导入依赖的package包/类
@Override
public Iterable<Row> getExistingForFilters(Iterable<Row> filters) throws Exception {
LOG.debug("Fetching filter rows from table: {}", tableName.toString());
List<Row> filterResults = Lists.newArrayList();
try (Table table = getConnection(config).getTable(tableName)) {
List<Get> gets = Lists.newArrayList();
List<Scan> scans = Lists.newArrayList();
for (Row filter : filters) {
// Construct row key from key columns
Query query = getSerde(config).convertToQuery(filter);
LOG.debug("Adding filter: {}", query);
if (query instanceof Get) {
gets.add((Get)query);
}
else if (query instanceof Scan) {
scans.add((Scan)query);
}
else {
throw new RuntimeException("Unsupported HBase query class: " + query.getClass().getName());
}
}
List<Result> results = Lists.newArrayList();
if (gets.size() > 0) {
results.addAll(Lists.newArrayList(table.get(gets)));
}
if (scans.size() > 0) {
Scan mergedScan = HBaseUtils.mergeRangeScans(scans);
results.addAll(Lists.newArrayList(table.getScanner(mergedScan)));
}
filterResults.addAll(getSerde(config).convertFromResults(results));
}
return filterResults;
}
开发者ID:cloudera-labs,项目名称:envelope,代码行数:39,代码来源:HBaseOutput.java
示例3: call
import org.apache.hadoop.hbase.client.Query; //导入依赖的package包/类
@Override
public Query call(Row row) throws Exception {
return serde.convertToQuery(row);
}
开发者ID:cloudera-labs,项目名称:envelope,代码行数:5,代码来源:HBaseSerde.java
示例4: testGetTasksWithFilter
import org.apache.hadoop.hbase.client.Query; //导入依赖的package包/类
@Test
public void testGetTasksWithFilter() throws Exception {
TaskMonitor tm = new TaskMonitor(new Configuration());
assertTrue("Task monitor should start empty", tm.getTasks().isEmpty());
// Create 5 general tasks
tm.createStatus("General task1");
tm.createStatus("General task2");
tm.createStatus("General task3");
tm.createStatus("General task4");
tm.createStatus("General task5");
// Create 5 rpc tasks, and mark 1 completed
int length = 5;
ArrayList<MonitoredRPCHandler> rpcHandlers = new ArrayList<>(length);
for (int i = 0; i < length; i++) {
MonitoredRPCHandler rpcHandler = tm.createRPCStatus("Rpc task" + i);
rpcHandlers.add(rpcHandler);
}
// Create rpc opertions
byte[] row = new byte[] { 0x01 };
Mutation m = new Put(row);
Query q = new Scan();
String notOperation = "for test";
rpcHandlers.get(0).setRPC("operations", new Object[]{ m, q }, 3000);
rpcHandlers.get(1).setRPC("operations", new Object[]{ m, q }, 3000);
rpcHandlers.get(2).setRPC("operations", new Object[]{ m, q }, 3000);
rpcHandlers.get(3).setRPC("operations", new Object[]{ notOperation }, 3000);
rpcHandlers.get(4).setRPC("operations", new Object[]{ m, q }, 3000);
MonitoredRPCHandler completed = rpcHandlers.get(4);
completed.markComplete("Completed!");
// Test get tasks with filter
List<MonitoredTask> generalTasks = tm.getTasks("general");
assertEquals(5, generalTasks.size());
List<MonitoredTask> handlerTasks = tm.getTasks("handler");
assertEquals(5, handlerTasks.size());
List<MonitoredTask> rpcTasks = tm.getTasks("rpc");
// The last rpc handler is stopped
assertEquals(4, rpcTasks.size());
List<MonitoredTask> operationTasks = tm.getTasks("operation");
// Handler 3 doesn't handle Operation.
assertEquals(3, operationTasks.size());
tm.shutdown();
}
开发者ID:apache,项目名称:hbase,代码行数:43,代码来源:TestTaskMonitor.java
示例5: convertToQuery
import org.apache.hadoop.hbase.client.Query; //导入依赖的package包/类
/**
* Convert the given {@link Row} to a {@link Query}
* @param row
* @return a {@link Query}
*/
Query convertToQuery(Row row);
开发者ID:cloudera-labs,项目名称:envelope,代码行数:7,代码来源:HBaseSerde.java
注:本文中的org.apache.hadoop.hbase.client.Query类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论