Return-Path: Delivered-To: apmail-hadoop-hbase-user-archive@minotaur.apache.org Received: (qmail 11678 invoked from network); 7 Jul 2009 02:54:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Jul 2009 02:54:03 -0000 Received: (qmail 98112 invoked by uid 500); 7 Jul 2009 02:54:13 -0000 Delivered-To: apmail-hadoop-hbase-user-archive@hadoop.apache.org Received: (qmail 98035 invoked by uid 500); 7 Jul 2009 02:54:13 -0000 Mailing-List: contact hbase-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hbase-user@hadoop.apache.org Delivered-To: mailing list hbase-user@hadoop.apache.org Received: (qmail 98025 invoked by uid 99); 7 Jul 2009 02:54:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jul 2009 02:54:13 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jul 2009 02:54:02 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1MO0oP-0002Zi-NP for hbase-user@hadoop.apache.org; Mon, 06 Jul 2009 19:53:41 -0700 Message-ID: <24366338.post@talk.nabble.com> Date: Mon, 6 Jul 2009 19:53:41 -0700 (PDT) From: Ishaaq Chandy To: hbase-user@hadoop.apache.org Subject: Re: Try to get qualifier collection In-Reply-To: <7c962aed0907061938l1fbc16adm9388458553442e75@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: ishaaq@gmail.com References: <4A44E350.6080509@streamy.com> <24365806.post@talk.nabble.com> <7c962aed0907061938l1fbc16adm9388458553442e75@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org Thanks for the quick responses guys. Yes, I did look at RowResult but its not very obvious what its supposed to do when dealing with a column family that consists of multiple qualifiers. Does each column family get a single key or does each qualifier get a single key in the entry set? I'm sorry, I guess I could run a test and check what it does but I am physically away from my machine which has HBase installed so I can't verify this - so I resorted to the documentation which didn't seem too clear to me. Thanks again, Ishaaq stack-3 wrote: > > On Mon, Jul 6, 2009 at 6:39 PM, Ishaaq Chandy 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 for Family >> > >> > Map 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 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 >> > >> > y_823910@tsmc.com 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. >> >> > > -- View this message in context: http://www.nabble.com/Try-to-get-qualifier-collection-tp24217280p24366338.html Sent from the HBase User mailing list archive at Nabble.com.