Return-Path: X-Original-To: apmail-accumulo-user-archive@www.apache.org Delivered-To: apmail-accumulo-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D8A8A10EAB for ; Tue, 12 Nov 2013 17:37:25 +0000 (UTC) Received: (qmail 57050 invoked by uid 500); 12 Nov 2013 17:37:25 -0000 Delivered-To: apmail-accumulo-user-archive@accumulo.apache.org Received: (qmail 56871 invoked by uid 500); 12 Nov 2013 17:37:19 -0000 Mailing-List: contact user-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@accumulo.apache.org Delivered-To: mailing list user@accumulo.apache.org Received: (qmail 56852 invoked by uid 99); 12 Nov 2013 17:37:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Nov 2013 17:37:18 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of texpilot@gmail.com designates 209.85.215.176 as permitted sender) Received: from [209.85.215.176] (HELO mail-ea0-f176.google.com) (209.85.215.176) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Nov 2013 17:37:11 +0000 Received: by mail-ea0-f176.google.com with SMTP id m14so2976274eaj.7 for ; Tue, 12 Nov 2013 09:36:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=7BroR8jsHaSyZyutSLLDToykzoaSYow5kBLJn90IpKg=; b=nu7W7a2RziwIU7mkn8tRadQGoP67lZrKgNeQXy26kFPDvRZMuKp+dhLWJeJetEoS0J xBKvi+TEAe5TYGaiB3nJZZsOvZEe7FBH7fOGneQ1QVAHc7a3NUW5cLRwkR8tOkOz7pbD X+gZdKgmqvnOrYiV1vOwFPdYiHLUWFPaFKvBuAdSOKoArkUZp8MfQzSAlYNqNoKGefDp 0FmTw3wBkI0iPII8tH6Q7PSqLJbPP/7DeW1YgxVQ04ipReS0NlicVkCscVKaRIWhH2zt GojqdZ6DhyuOYuwo8dJB42bhNQXDPzcOqTy46iIwDiP0sR7dTGcJGpEDPWQ1uSWgY1R/ 0qDg== MIME-Version: 1.0 X-Received: by 10.15.60.197 with SMTP id g45mr2094072eex.103.1384277811530; Tue, 12 Nov 2013 09:36:51 -0800 (PST) Received: by 10.223.156.3 with HTTP; Tue, 12 Nov 2013 09:36:51 -0800 (PST) In-Reply-To: References: Date: Tue, 12 Nov 2013 11:36:51 -0600 Message-ID: Subject: Re: How to remove entire row at the server side? From: "Terry P." To: "user@accumulo.apache.org" Content-Type: multipart/alternative; boundary=089e01681c443a0f7104eafe4b76 X-Virus-Checked: Checked by ClamAV on apache.org --089e01681c443a0f7104eafe4b76 Content-Type: text/plain; charset=UTF-8 Keith, you are my hero! From tests using various column family configs to test various configs, it appears to be working like a charm. Now I'm working on the IteratorOptions part so the expirationTimestamp column family name and datetime format can be set at the installation time of the Iterator. Many, many thanks Keith, your example really helps me understand row-based iterators much better. Thanks again to everyone else for your assistance as well. Accumulo has such a great community! Kind regards, Terry On Fri, Nov 8, 2013 at 8:49 AM, Keith Turner wrote: > > > > On Fri, Nov 8, 2013 at 12:26 AM, Terry P. wrote: > >> Hi Keith, >> Given that what I need to filter on is only the expTs column family, >> would it be faster to seek? I don't know how to seek, but I also can't >> figure out how to iterate inside the acceptRow method -- there's no scanner >> as I normally use when reading and iterating over key/values. >> > > I think in your case you should iterate, because you are only advancing a > few keys. Some of the iterators in Accumulo try to iterator for a few > keys, and if something is not found in 10 keys then seek. > > Could do something like the following. > > > ByteSequence expTsColFam = new ArrayByteSequence("expTs"); > > @Override > public boolean acceptRow(SortedKeyValueIterator > rowIterator) throws IOException { > while(rowIterator.hasTop()){ > //this is faster becaue it compares against byte arrays in key > directly w/o converting to string > int cmp > = rowIterator.getTopKey().getColumnFamilyData().compareTo(expTsColFam); > if (cmp == 0) { > .... > }else if(cmp > 0){ > //went past column family > //can only do this w/ col fam since it next field in sort > order after row > break; > } > rowIterator.next(); > } > > return true; > } > > >> >> --089e01681c443a0f7104eafe4b76 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Keith, you are my hero!=C2=A0 From tests us= ing various column family configs to test various configs, it appears to be= working like a charm.=C2=A0 Now I'm working on the IteratorOptions par= t so the expirationTimestamp column family name and datetime format can be = set at the installation time of the Iterator.

Many, many thanks Keith, your example really helps me understand = row-based iterators much better.

Thanks again to everyone else= for your assistance as well.=C2=A0 Accumulo has such a great community!
Kind regards,
Terry


On Fri, Nov 8, 2013 at 8:49 AM, Keith= Turner <keith@deenlo.com> wrote:



On Fri, Nov 8, 2013 at 12:26 AM= , Terry P. <texpilot@gmail.com> wrote:
Hi Keith,
Given that what I need to filter on is only the expTs column family, would = it be faster to seek?=C2=A0 I don't know how to seek, but I also can= 9;t figure out how to iterate inside the acceptRow method -- there's no= scanner as I normally use when reading and iterating over key/values.=C2= =A0

I think in your case you shoul= d iterate, =C2=A0because you are only advancing a few keys. =C2=A0 Some of = the iterators in Accumulo try to iterator for a few keys, and if something = is not found in 10 keys then seek.

Could do something like the following. =C2=A0


=C2=A0 ByteSequence=C2=A0expTsColFam =3D new= ArrayByteSequence("expTs");

@= Override
=C2=A0 public boolean acceptRow(SortedKeyValueIterator<Key, Value&g= t; rowIterator)=C2=A0=C2=A0throws IOException {
=C2= =A0 =C2=A0 =C2=A0 =C2=A0while(rowIterator.hasTop()){
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 //this is faster becaue it compares against= byte arrays in key directly w/o converting to string
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 int cmp =3D=C2=A0rowIterator= .getTopKey().getColumnFamilyData().compareTo(expTsColFam);
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0if (cmp =3D=3D 0) {
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0....
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }else if(cmp > 0){
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0//went p= ast column family
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0//can only do this w/ col fam since it next field in sort = order after row
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0break;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rowIterator.next();
=C2=A0 =C2=A0 =C2=A0 =C2=A0}

=C2=A0 =C2=A0 =C2= =A0 =C2=A0return true;
=C2=A0 }
=C2=A0
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;pa= dding-left:1ex">

--089e01681c443a0f7104eafe4b76--