hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zhongchaoqiang <zhongchaoqi...@huawei.com>
Subject 答复: to get all column qualifiers
Date Wed, 10 Dec 2014 01:19:00 GMT
Hi beeshma

You should transfer "byte[]" to "String" with using Bytes class.

For example:
System.out.println(Bytes.toString(entry.getKey()));

-----邮件原件-----
发件人: beeshma r [mailto:beeshma48@gmail.com] 
发送时间: 2014年12月10日 2:24
收件人: user@hbase.apache.org
主题: to get all column qualifiers

Hi
i want to get all column qualifiers and  corresponding cell values for the Rowkey for example
below is table structure

hbase(main):002:0> scan "people"
ROW
COLUMN+CELL
 anandh@hotmail.com   column=colmn_fam:anandh@hotmail.com,
timestamp=14160315498
                      33,
value=1
 beeshma@gmail.com    column=colmn_fam:beeshma@gmail.com,
timestamp=141590081652
                      2,
value=\x00\x00\x00\x01
 ed@gmail.com         column=colmn_fam:ed@gmail.com,
timestamp=1415900817028, va

lue=\x00\x00\x00\x01
 gardon@gmail.com     column=colmn_fam:gardon@gmail.com,
timestamp=1416031549845
                      ,
value=1
 james@gmail.com      column=colmn_fam:james@gmail.com,
timestamp=1415900817017,

value=\x00\x00\x00\x01
 kaleesan@gmail.com   column=colmn_fam:kaleesan@gmail.com,
timestamp=14160315498
                      40,
value=1
 krish@gmail.com      column=colmn_fam:krish@gmail.com,
timestamp=1416148432981,

value=1
 pele@gmail.com       column=colmn_fam:pele@gmail.com,
timestamp=1416031549850,

value=1
 ran@gmail.com        column=colmn_fam:ran@gmail.com,
timestamp=1416722434614, v

alue=1
 yale@gmail.com       column=colmn_fam:yale@gmail.com,
timestamp=1415900817022,

value=\x00\x00\x00\x01
 yun@gmail.com        column=colmn_fam:yun@gmail.com,
timestamp=1415900817035, v
                      alue=\x00\x00\x00\x01

for key =>anandh@hotmail.com i have to get  all columnqualifiers in "colmn_fam" column
family

so what is the way to get that?i tried below samples but i didnt get  what i expect..please
suggest the best way to get that

here i tried some methods


Get get_colums=new Get(ROWKEY);

Result result_of_coumns=testTable.get(get_colums);


    Map    <byte[],byte[]>
family=result_of_coumns.getFamilyMap(colmnfamily);

    for (Map.Entry<byte[],byte[]> entry:family.entrySet())
    {
        System.out.println(entry.getKey());
        System.out.println(entry.getValue());
    }


O/P

[B@35e023f0
[B@e577d32


LiST METHOD


List <String> mail_list = new ArrayList<String>();

Result result_of_coumns=testTable.get(get_colums);

for(Byte kv:result_of_coumns.getRow())
    {
System.out.println(kv.toString());
mail_list.add(kv.toString());

    }

for(String temp:mail_list)
    {
        System.out.println(temp.toString());
    }



 O/P

97
121
121
111
64
103
109
97
105
108
46
99
111
109

Thanks
Beesh
Mime
View raw message