On Mon, Jul 6, 2009 at 6:39 PM, Ishaaq Chandy <[email protected]> wrote:
> > Hmm, I have a similar requirement. However, when looking at the API I > cannot > see these classes: Get and Result. Are these 0.20.0 classes? If so, what > would be the equivalent for 0.19.3? Yes. These are 0.20.0 classes. In 0.19.3, use RowResult. Iterate entrySet: http://hadoop.apache.org/hbase/docs/r0.19.3/api/org/apache/hadoop/hbase/io/RowResult.html#entrySet(). Its keyed by column. St.Ack Thanks, > Ishaaq > > > Jonathan Gray-2 wrote: > > > > Fleming, > > > > Of course there is! > > > > Look at some of the different methods in Result that return various Maps > > in different format. For your example, you might do: > > > > ======= > > > > HTable table = new HTable("Table1"); > > Get g = new Get(Bytes.toBytes("Key1")); > > Result r = table.get(g); > > > > // Get a Map<qualifier,value> for Family > > > > Map<byte[],byte[]> family = r.getFamilyMap(Bytes.toBytes("Family")); > > > > // You can get a value knowing the qualifier > > > > byte [] value1 = family.get(Bytes.toBytes("qualifier1")); > > > > // Or you can just iterate all the qualifiers and values > > > > for(Map.Entry<byte[],byte[]> entry : family.entrySet()) { > > byte [] qualifier = entry.getKey(); > > byte [] value = entry.getValue(); > > } > > > > ======= > > > > All the maps that are returned by Result are NavigableMaps, so they are > > sorted and allow a number of operations on them. > > > > Hope that helps. > > > > JG > > > > [email protected] wrote: > >> Hi there, > >> > >> I have a table "Table1" with one Family and 10 qualifier. > >> Any ways that I can get these qualifier's name in Table1, > >> then I can loop qualifier collection to fetch each qualifier's value. > >> Thank you > >> > >> Fleming > >> > >> > ==================================================================================== > >> > >> HTable table = new HTable(config, "Table1"); > >> Get g = new Get(Bytes.toBytes("Key1")); > >> Result r = table.get(g); > >> byte [] value1 = r.getValue(Bytes.toBytes("Family"), > >> Bytes.toBytes("qualifier1")); > >> String valueStr1 = Bytes.toString(value1); > >> byte [] value2 = r.getValue(Bytes.toBytes("Family"), > >> Bytes.toBytes("qualifier2")); > >> String valueStr2 = Bytes.toString(value2); > >> . > >> . > >> . > >> > >> byte [] value10 = r.getValue(Bytes.toBytes("Family"), > >> Bytes.toBytes("qualifier10")); > >> String valueStr10 = Bytes.toString(value10); > >> > >> > --------------------------------------------------------------------------- > >> TSMC PROPERTY > >> This email communication (and any attachments) is proprietary > >> information > >> for the sole use of its > >> intended recipient. Any unauthorized review, use or distribution by > >> anyone > >> other than the intended > >> recipient is strictly prohibited. If you are not the intended > >> recipient, > >> please notify the sender by > >> replying to this email, and then delete this email and any copies of it > >> immediately. Thank you. > >> > >> > --------------------------------------------------------------------------- > >> > >> > >> > > > > > > -- > View this message in context: > http://www.nabble.com/Try-to-get-qualifier-collection-tp24217280p24365806.html > Sent from the HBase User mailing list archive at Nabble.com. > >
