本文整理汇总了Java中org.apache.hadoop.hbase.thrift.generated.TScan.setStartRow方法的典型用法代码示例。如果您正苦于以下问题:Java TScan.setStartRow方法的具体用法?Java TScan.setStartRow怎么用?Java TScan.setStartRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.thrift.generated.TScan
的用法示例。
在下文中一共展示了TScan.setStartRow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scanOneColumn
import org.apache.hadoop.hbase.thrift.generated.TScan; //导入方法依赖的package包/类
/**
* scan 讀取特定column
*
* @throws Exception
*/
@Test
// 1053 at mills.
// 897 at mills.
// 888 at mills.
public void scanOneColumn() throws Exception {
// String TABLE_NAME = "ItemCreation_Buffer_Item";
// String rowKey =
// "0016630555\\x0501\\x0501\\x05A1FS\\x05CreateItem\\x0516630555\\x050000116\\x05670744-086876166705";
// String cloumn = "ItemInfo:SellerId";
String TABLE_NAME = "UIH_OverallItemInfo";
String rowKey = "1000|I200|A17P|AUDI15028071";
String cloumn = "CommonInfo:SellerID";
List<TRowResult> results = null;
//
List<ByteBuffer> columns = new LinkedList<ByteBuffer>();
columns.add(ByteBufferHelper.toByteBuffer(cloumn));
Map<ByteBuffer, ByteBuffer> attributes = new HashMap<ByteBuffer, ByteBuffer>();
//
TScan scan = new TScan();
scan.setCaching(200);
scan.setStartRow(ByteBufferHelper.toByteBuffer(rowKey));
// scan.setStopRow(ByteBufferHelper.toByteBuffer(rowKey));
scan.setColumns(columns);
//
int scannerId = 0;
long beg = System.currentTimeMillis();
try {
scannerId = client.scannerOpenWithScan(
ByteBufferHelper.toByteBuffer(TABLE_NAME), scan, attributes);// 可以attributes=null
results = client.scannerGetList(scannerId, 10);// 讀取幾筆
} catch (Exception ex) {
ex.printStackTrace();
} finally {
if (scannerId >= 0) {
client.scannerClose(scannerId);// 一定要關閉
}
}
long end = System.currentTimeMillis();
System.out.println((end - beg) + " at mills.");
printlnResult(results);
}