欢迎投稿

今日深度:

hbase 通过rowkey读取数据,hbaserowkey

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);

www.htsjk.Com true http://www.htsjk.com/hbase/32428.html NewsArticle hbase 通过rowkey读取数据,hbaserowkey public class Texta { public static void main (String[] args) { //假设rowkey由3个字段组成(字段类型为Long) byte [] bs = Bytes.add(Bytes.toBytes( 1 L), Bytes.toBytes( 12 L),Bytes.to...
相关文章
    暂无相关文章
评论暂时关闭