to get all column qualifiers

2014-12-09 Thread beeshma r
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
 ana...@hotmail.com   column=colmn_fam:ana...@hotmail.com,
timestamp=14160315498
  33,
value=1
 bees...@gmail.comcolumn=colmn_fam:bees...@gmail.com,
timestamp=141590081652
  2,
value=\x00\x00\x00\x01
 e...@gmail.com column=colmn_fam:e...@gmail.com,
timestamp=1415900817028, va

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

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

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

value=1
 r...@gmail.comcolumn=colmn_fam:r...@gmail.com,
timestamp=1416722434614, v

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

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

for key =ana...@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);


Mapbyte[],byte[]
family=result_of_coumns.getFamilyMap(colmnfamily);

for (Map.Entrybyte[],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 ArrayListString();

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


答复: to get all column qualifiers

2014-12-09 Thread Zhongchaoqiang
Hi beeshma

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

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

-邮件原件-
发件人: beeshma r [mailto:beeshm...@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
 ana...@hotmail.com   column=colmn_fam:ana...@hotmail.com,
timestamp=14160315498
  33,
value=1
 bees...@gmail.comcolumn=colmn_fam:bees...@gmail.com,
timestamp=141590081652
  2,
value=\x00\x00\x00\x01
 e...@gmail.com column=colmn_fam:e...@gmail.com,
timestamp=1415900817028, va

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

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

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

value=1
 r...@gmail.comcolumn=colmn_fam:r...@gmail.com,
timestamp=1416722434614, v

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

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

for key =ana...@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);


Mapbyte[],byte[]
family=result_of_coumns.getFamilyMap(colmnfamily);

for (Map.Entrybyte[],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 ArrayListString();

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