Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DBE27200B8F for ; Fri, 30 Sep 2016 19:31:50 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D8DB5160AD9; Fri, 30 Sep 2016 17:31:50 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CEE5F160AB4 for ; Fri, 30 Sep 2016 19:31:49 +0200 (CEST) Received: (qmail 82763 invoked by uid 500); 30 Sep 2016 17:31:49 -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 82752 invoked by uid 99); 30 Sep 2016 17:31:48 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Sep 2016 17:31:48 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 8B13DC8248 for ; Fri, 30 Sep 2016 17:31:48 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.021 X-Spam-Level: X-Spam-Status: No, score=-3.021 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=2, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id Qr_enFuM-4DP for ; Fri, 30 Sep 2016 17:31:47 +0000 (UTC) Received: from bos-mailout2.raytheon.com (bos-mailout2.raytheon.com [199.46.198.208]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 400F55F2C4 for ; Fri, 30 Sep 2016 17:31:47 +0000 (UTC) Received: from ma-mailout10.rtnmail.ray.com (ma-mailout10.rtnmail.ray.com [147.25.130.27]) by bos-mailout2.raytheon.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id u8UHVe7W022586 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 30 Sep 2016 17:31:40 GMT Received: from smtp.bbn.com ([128.33.1.81]) by ma-mailout10.rtnmail.ray.com (8.15.0.59/8.15.0.59) with ESMTPS id u8UHVeEA000593 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 30 Sep 2016 17:31:40 GMT Received: from dhcp33-29-9.bbn.com ([128.33.29.9]:57488 helo=DBLUM14LAP) by smtp.bbn.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1bq1eu-0006lK-2e for user@accumulo.apache.org; Fri, 30 Sep 2016 13:31:40 -0400 From: "Dan Blum" To: References: In-Reply-To: Subject: RE: Modify Keys within iterator Date: Fri, 30 Sep 2016 13:31:39 -0400 Message-ID: <018901d21b40$80d49cc0$827dd640$@bbn.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_018A_01D21B1E.F9C2FCC0" X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQGkvStNh4uhegouuvitgXZc+P3CBaDtBplw Content-Language: en-us X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-09-30_07:,, signatures=0 archived-at: Fri, 30 Sep 2016 17:31:51 -0000 This is a multipart message in MIME format. ------=_NextPart_000_018A_01D21B1E.F9C2FCC0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable What code are you using to test the iterator, where you see no output? =20 From: Yamini Joshi [mailto:yamini.1691@gmail.com]=20 Sent: Friday, September 30, 2016 1:26 PM To: user@accumulo.apache.org Subject: Modify Keys within iterator =20 Hello Everyone! I am trying to write an iterator to modify keys within a table (at = scan). My use case is to select a few records that match a certain = criterion and then modify them within the iterator(using the following = class) for some other succeeding iterator/combiner. The problem is that = this iterator does return any records/keys. I added some primitive = prints and found that the keys (this.key) is changed but the output of = iterator is nothing. I'd appreciate if someone could give me any = insight. I'm sure I'm making a teeny tiny mistake somewhere. Schema: row colF colQ = ts Val I/P: r_1 f f_1 = v1 r_1 fx f_1 = v1 O/P: f_1 r r_1 = v1 f_1 fx fx = v1 =20 public class KeyModifyIterator implements = SortedKeyValueIterator { private SortedKeyValueIterator source; private Key key; private Value value; @Override public void init(SortedKeyValueIterator source, = Map options, IteratorEnvironment env) throws IOException = { this.source =3D source; } @Override public boolean hasTop() { return key !=3D null; } @Override public void next() throws IOException { if (source.hasTop()) { ByteSequence currentRow =3D source.getTopKey().getRowData(); ByteSequence currentColf =3D = source.getTopKey().getColumnFamilyData(); ByteSequence currentColq =3D = source.getTopKey().getColumnQualifierData(); long ts =3D source.getTopKey().getTimestamp(); String v =3D source.getTopValue().toString(); System.out.println("Key =3D " + currentRow.toString() + " Cf = =3D " + currentColf.toString() + " Cq =3D " + currentColq.toString() + = " val =3D " + v.toString()); =20 if (currentColf.toString().equals("fx")){ System.out.println("Updating fx" ); this.key =3D new Key(currentColq.toArray(), = currentColf.toArray(), currentColf.toArray(), new byte[0], ts); this.value =3D new Value (v.getBytes(UTF_8)); } else{ System.out.println("Updating other" ); this.key =3D new Key(currentColq.toArray(), = "r".getBytes(UTF_8), currentRow.toArray(), new byte[0], ts); = =20 this.value =3D new Value (v.getBytes(UTF_8)); System.out.println(this.key.toString()); } =20 =20 =20 source.next(); =20 =20 } else { this.key =3D null; this.value =3D null; } } @Override public void seek(Range range, Collection columnFamilies, = boolean inclusive) throws IOException {=20 source.seek(range, columnFamilies, inclusive); next(); } @Override public Key getTopKey() { return key; } @Override public Value getTopValue() { return value; } @Override public SortedKeyValueIterator deepCopy(IteratorEnvironment = env) { return null; } =20 } Best regards, Yamini Joshi ------=_NextPart_000_018A_01D21B1E.F9C2FCC0 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

What code are you using to test the iterator, where you see no = output?

 

From:= = Yamini Joshi [mailto:yamini.1691@gmail.com]
Sent: Friday, = September 30, 2016 1:26 PM
To: = user@accumulo.apache.org
Subject: Modify Keys within = iterator

 

Hello = Everyone!

I am trying to write an iterator to = modify keys within a table (at scan). My use case is to select a few = records that match a certain criterion and then modify them within the = iterator(using the following class) for some other succeeding = iterator/combiner. The problem is that this iterator does return any = records/keys. I added some primitive prints and found that the keys = (this.key) is changed but the output of iterator is nothing. I'd = appreciate if someone could give me any insight. I'm sure I'm making a = teeny tiny mistake somewhere.

Schema:

         = row           &nbs= p;       = colF           &nb= sp;           = colQ           &nb= sp;     = ts            = ;    Val

I/P:    = r_1           &nbs= p;       f        =                   =    f_1                 =                    =   v1

         r_1 =                   fx   =                     =      f_1              =                     =     v1

O/P:  f_1 =                   = r            =             &= nbsp;    = r_1           &nbs= p;            = ;            =   v1

         = f_1           &nbs= p;       = fx            = ;            =     = fx            = ;            =             &= nbsp;   v1

 



public class KeyModifyIterator implements = SortedKeyValueIterator<Key,Value> {

  private = SortedKeyValueIterator<Key,Value> source;
  private Key = key;
  private Value value;

  @Override
  = public void init(SortedKeyValueIterator<Key,Value> source, = Map<String,String> options, IteratorEnvironment env) throws = IOException {
    this.source =3D source;
  = }

  @Override
  public boolean hasTop() = {
    return key !=3D null;
  }

  = @Override
  public void next() throws IOException = {
        if (source.hasTop()) = {
            = ByteSequence currentRow =3D = source.getTopKey().getRowData();
    =         ByteSequence currentColf =3D = source.getTopKey().getColumnFamilyData();
    =         ByteSequence currentColq =3D = source.getTopKey().getColumnQualifierData();
    =         long ts =3D = source.getTopKey().getTimestamp();
    =         String v =3D = source.getTopValue().toString();
    =         System.out.println("Key =3D = " + currentRow.toString() + " Cf =3D " + = currentColf.toString() + " Cq =3D " + = currentColq.toString()  + " val =3D " + = v.toString());
        =    
        =     if = (currentColf.toString().equals("fx")){
    =             = System.out.println("Updating fx" );
    =             this.key = =3D new Key(currentColq.toArray(), currentColf.toArray(), = currentColf.toArray(), new byte[0], ts);
    =             this.value = =3D new Value (v.getBytes(UTF_8));
    =         }
    =         else{
    =             = System.out.println("Updating other" );
    =             this.key =3D = new Key(currentColq.toArray(), "r".getBytes(UTF_8), = currentRow.toArray(), new byte[0], ts);    =             =
            =     this.value =3D new Value = (v.getBytes(UTF_8));
        =         = System.out.println(this.key.toString());
    =         }
    =        
    =        
    =        
    =         = source.next();
    =        
    =        
    =       } else {
    =         this.key =3D = null;
            = this.value =3D null;
      }
  = }

  @Override
  public void seek(Range range, = Collection<ByteSequence> columnFamilies, boolean inclusive) throws = IOException {
    source.seek(range, columnFamilies, = inclusive);
    next();
  }

  = @Override
  public Key getTopKey() {
    = return key;
  }

  @Override
  public Value = getTopValue() {
    return value;
  = }

  @Override
  public = SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment = env) {
    return null;
  }

  =
}


Best regards,
Yamini = Joshi

------=_NextPart_000_018A_01D21B1E.F9C2FCC0--