本文整理汇总了Java中org.apache.hadoop.hbase.client.Result.getExists方法的典型用法代码示例。如果您正苦于以下问题:Java Result.getExists方法的具体用法?Java Result.getExists怎么用?Java Result.getExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.client.Result
的用法示例。
在下文中一共展示了Result.getExists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toResult
import org.apache.hadoop.hbase.client.Result; //导入方法依赖的package包/类
/**
* Convert a client Result to a protocol buffer Result
*
* @param result the client Result to convert
* @return the converted protocol buffer Result
*/
public static ClientProtos.Result toResult(final Result result) {
if (result.getExists() != null) {
return toResult(result.getExists(), result.isStale());
}
Cell[] cells = result.rawCells();
if (cells == null || cells.length == 0) {
return result.isStale() ? EMPTY_RESULT_PB_STALE : EMPTY_RESULT_PB;
}
ClientProtos.Result.Builder builder = ClientProtos.Result.newBuilder();
for (Cell c : cells) {
builder.addCell(toCell(c));
}
builder.setStale(result.isStale());
builder.setPartial(result.isPartial());
return builder.build();
}
示例2: toResultNoData
import org.apache.hadoop.hbase.client.Result; //导入方法依赖的package包/类
/**
* Convert a client Result to a protocol buffer Result.
* The pb Result does not include the Cell data. That is for transport otherwise.
*
* @param result the client Result to convert
* @return the converted protocol buffer Result
*/
public static ClientProtos.Result toResultNoData(final Result result) {
if (result.getExists() != null) return toResult(result.getExists(), result.isStale());
int size = result.size();
if (size == 0) return result.isStale() ? EMPTY_RESULT_PB_STALE : EMPTY_RESULT_PB;
ClientProtos.Result.Builder builder = ClientProtos.Result.newBuilder();
builder.setAssociatedCellCount(size);
builder.setStale(result.isStale());
return builder.build();
}