Return-Path: Delivered-To: apmail-hadoop-hbase-user-archive@minotaur.apache.org Received: (qmail 8478 invoked from network); 7 Jul 2009 02:38:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Jul 2009 02:38:56 -0000 Received: (qmail 92176 invoked by uid 500); 7 Jul 2009 02:39:05 -0000 Delivered-To: apmail-hadoop-hbase-user-archive@hadoop.apache.org Received: (qmail 92108 invoked by uid 500); 7 Jul 2009 02:39:05 -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 92098 invoked by uid 99); 7 Jul 2009 02:39:05 -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:39:05 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of saint.ack@gmail.com designates 209.85.221.188 as permitted sender) Received: from [209.85.221.188] (HELO mail-qy0-f188.google.com) (209.85.221.188) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jul 2009 02:38:54 +0000 Received: by qyk26 with SMTP id 26so2948895qyk.5 for ; Mon, 06 Jul 2009 19:38:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type; bh=X0TBDfY5bcl9wW1dynqiKDXTp3YWLZUaIn49mw3Xp7E=; b=A03uNmLOOMCWOcCZFcgMubWM8L5G5ZYE30jaL12/jGt7Fnop7n4abk8tPwJiSWsdQk awFvsOr1Ef+jVTF/iZGbsezu/fxCQG5ZRL40+B/2oYCM73s+Tju778FIo6wCMpbclmgh uFCc6yEmHYj64H1AAyLHCeOMRBE+xco+ZIiK0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=sxDWovO6I3TZNjIfgz0ZdZI75TAsZa0fkc/Z+X/++T6Cby/jCWuxVUTLdDmHdOft7U BY2siylxJiJIhFPTKGW0wR9sDFJ2MfU7kW2WK/gXF0L097mdCOtiNZfXAMmYl8/PvZg/ 5mKUP7JmUGSTZ/DabZleltyjpLuI5twNRcOu4= MIME-Version: 1.0 Sender: saint.ack@gmail.com Received: by 10.229.85.4 with SMTP id m4mr2923934qcl.55.1246934313738; Mon, 06 Jul 2009 19:38:33 -0700 (PDT) In-Reply-To: <24365806.post@talk.nabble.com> References: <4A44E350.6080509@streamy.com> <24365806.post@talk.nabble.com> Date: Mon, 6 Jul 2009 19:38:33 -0700 X-Google-Sender-Auth: 11f46a4b0ce59ebf Message-ID: <7c962aed0907061938l1fbc16adm9388458553442e75@mail.gmail.com> Subject: Re: Try to get qualifier collection From: stack To: hbase-user@hadoop.apache.org Content-Type: multipart/alternative; boundary=001636aa2c4cd421d5046e14843a X-Virus-Checked: Checked by ClamAV on apache.org --001636aa2c4cd421d5046e14843a Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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. > > --001636aa2c4cd421d5046e14843a--