hbase 通过rowkey读取数据,hbaserowkey
public class Texta {
public static void main(String[] args) {
//假设rowkey由3个字段组成(字段类型为Long)
byte[] bs = Bytes.add(Bytes.toBytes(1L), Bytes.toBytes(12L),Bytes.toBytes(11L));
//截取我们需要的字段进行匹配
long long2 = Bytes.toLong(bs, 16,8);
// **字段类型为int**
byte[] bi = Bytes.add(Bytes.toBytes(1), Bytes.toBytes(2));
int int1 = Bytes.toInt(bi, 4, 4);
System.out.println("int1="+int1);
System.out.println();
System.out.println("------------");
System.out.println(long2);
long long1 = Bytes.toLong(bs, 0,8);
System.out.println();
System.out.println("--------------------");
System.out.println(long1);
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。