本文整理汇总了Java中org.apache.hadoop.hbase.avro.generated.AResult类的典型用法代码示例。如果您正苦于以下问题:Java AResult类的具体用法?Java AResult怎么用?Java AResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AResult类属于org.apache.hadoop.hbase.avro.generated包,在下文中一共展示了AResult类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: resultToAResult
import org.apache.hadoop.hbase.avro.generated.AResult; //导入依赖的package包/类
static public AResult resultToAResult(Result result) {
AResult aresult = new AResult();
byte[] row = result.getRow();
aresult.row = ByteBuffer.wrap(row != null ? row : new byte[1]);
Schema s = Schema.createArray(AResultEntry.SCHEMA$);
GenericData.Array<AResultEntry> entries = null;
List<KeyValue> resultKeyValues = result.list();
if (resultKeyValues != null && resultKeyValues.size() > 0) {
entries = new GenericData.Array<AResultEntry>(resultKeyValues.size(), s);
for (KeyValue resultKeyValue : resultKeyValues) {
AResultEntry entry = new AResultEntry();
entry.family = ByteBuffer.wrap(resultKeyValue.getFamily());
entry.qualifier = ByteBuffer.wrap(resultKeyValue.getQualifier());
entry.value = ByteBuffer.wrap(resultKeyValue.getValue());
entry.timestamp = resultKeyValue.getTimestamp();
entries.add(entry);
}
} else {
entries = new GenericData.Array<AResultEntry>(0, s);
}
aresult.entries = entries;
return aresult;
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:24,代码来源:AvroUtil.java
示例2: scannerGetRows
import org.apache.hadoop.hbase.avro.generated.AResult; //导入依赖的package包/类
public GenericArray<AResult> scannerGetRows(int scannerId, int numberOfRows) throws AIOError, AIllegalArgument {
try {
ResultScanner scanner = getScanner(scannerId);
if (scanner == null) {
AIllegalArgument aie = new AIllegalArgument();
aie.message = new Utf8("scanner ID is invalid: " + scannerId);
throw aie;
}
return AvroUtil.resultsToAResults(scanner.next(numberOfRows));
} catch (IOException e) {
AIOError ioe = new AIOError();
ioe.message = new Utf8(e.getMessage());
throw ioe;
}
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:16,代码来源:AvroServer.java
示例3: resultsToAResults
import org.apache.hadoop.hbase.avro.generated.AResult; //导入依赖的package包/类
static public GenericArray<AResult> resultsToAResults(Result[] results) {
Schema s = Schema.createArray(AResult.SCHEMA$);
GenericData.Array<AResult> aresults = null;
if (results != null && results.length > 0) {
aresults = new GenericData.Array<AResult>(results.length, s);
for (Result result : results) {
aresults.add(resultToAResult(result));
}
} else {
aresults = new GenericData.Array<AResult>(0, s);
}
return aresults;
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:14,代码来源:AvroUtil.java
示例4: testGetEmpty
import org.apache.hadoop.hbase.avro.generated.AResult; //导入依赖的package包/类
@Test
public void testGetEmpty() {
Result result = Mockito.mock(Result.class);
Mockito.when(result.getRow()).thenReturn(null);
//Get on a row, that does not exist, returns a result,
//whose row is null.
AResult aresult = AvroUtil.resultToAResult(result);
Assert.assertNotNull(aresult);
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:10,代码来源:TestAvroUtil.java
注:本文中的org.apache.hadoop.hbase.avro.generated.AResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论