Return-Path: X-Original-To: apmail-incubator-accumulo-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-accumulo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E59B797E9 for ; Thu, 10 Nov 2011 20:13:47 +0000 (UTC) Received: (qmail 5944 invoked by uid 500); 10 Nov 2011 20:13:47 -0000 Delivered-To: apmail-incubator-accumulo-commits-archive@incubator.apache.org Received: (qmail 5914 invoked by uid 500); 10 Nov 2011 20:13:47 -0000 Mailing-List: contact accumulo-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: accumulo-dev@incubator.apache.org Delivered-To: mailing list accumulo-commits@incubator.apache.org Received: (qmail 5907 invoked by uid 99); 10 Nov 2011 20:13:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Nov 2011 20:13:47 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Nov 2011 20:13:46 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 1C67923888FE; Thu, 10 Nov 2011 20:13:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1200521 - in /incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java: iterator/FieldIndexIterator.java logic/AbstractQueryLogic.java logic/ContentLogic.java Date: Thu, 10 Nov 2011 20:13:25 -0000 To: accumulo-commits@incubator.apache.org From: ecn@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111110201326.1C67923888FE@eris.apache.org> Author: ecn Date: Thu Nov 10 20:13:25 2011 New Revision: 1200521 URL: http://svn.apache.org/viewvc?rev=1200521&view=rev Log: ACCUMULO-92 remove LGPL dependencies Modified: incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java/iterator/FieldIndexIterator.java incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java/logic/AbstractQueryLogic.java incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java/logic/ContentLogic.java Modified: incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java/iterator/FieldIndexIterator.java URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java/iterator/FieldIndexIterator.java?rev=1200521&r1=1200520&r2=1200521&view=diff ============================================================================== --- incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java/iterator/FieldIndexIterator.java (original) +++ incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java/iterator/FieldIndexIterator.java Thu Nov 10 20:13:25 2011 @@ -75,9 +75,6 @@ public class FieldIndexIterator extends functions.put("f", QueryFunctions.class); engine.setFunctions(functions); } - // Wrapping iterator only accesses its private source in setSource and getSource - // Since this class overrides these methods, it's safest to keep the source declaration here - private SortedKeyValueIterator source; public static void setLogLevel(Level l) { log.setLevel(l); @@ -124,7 +121,7 @@ public class FieldIndexIterator extends } public FieldIndexIterator(FieldIndexIterator other, IteratorEnvironment env) { - source = other.getSource().deepCopy(env); + setSource(other.getSource().deepCopy(env)); //Set a default KeyParser keyParser = createDefaultKeyParser(); } @@ -134,23 +131,7 @@ public class FieldIndexIterator extends return parser; } - //------------------------------------------------------------------------- - //------------- Overrides - @Override - public void init(SortedKeyValueIterator source, Map options, IteratorEnvironment env) throws IOException { - super.init(source, options, env); - source = super.getSource(); - } - - @Override - protected void setSource(SortedKeyValueIterator source) { - this.source = source; - } - @Override - protected SortedKeyValueIterator getSource() { - return source; - } @Override public SortedKeyValueIterator deepCopy(IteratorEnvironment env) { @@ -181,18 +162,18 @@ public class FieldIndexIterator extends currentRow = topKey.getRow(); } - source.next(); + getSource().next(); while (true) { log.debug("next(), Range: " + range); - if (source.hasTop()) { - Key k = source.getTopKey(); + if (getSource().hasTop()) { + Key k = getSource().getTopKey(); if (range.contains(k)) { if (matches(k)) { topKey = k; - topValue = source.getTopValue(); + topValue = getSource().getTopValue(); return; } else { - source.next(); + getSource().next(); } } else { @@ -229,7 +210,7 @@ public class FieldIndexIterator extends if (log.isDebugEnabled()) { log.debug("next, range: " + range); } - source.seek(range, EMPTY_COL_FAMS, false); + getSource().seek(range, EMPTY_COL_FAMS, false); } } else { topKey = null; @@ -290,23 +271,23 @@ public class FieldIndexIterator extends if (log.isDebugEnabled()) { log.debug("seek, incoming range: " + range); } - source.seek(range, columnFamilies, inclusive); + getSource().seek(range, columnFamilies, inclusive); while (topKey == null) { - if (source.hasTop()) { + if (getSource().hasTop()) { if (log.isDebugEnabled()) { - log.debug("seek, source has top: " + source.getTopKey()); + log.debug("seek, source has top: " + getSource().getTopKey()); } - Key k = source.getTopKey(); + Key k = getSource().getTopKey(); if (range.contains(k)) { if (matches(k)) { topKey = k; - topValue = source.getTopValue(); + topValue = getSource().getTopValue(); if (log.isDebugEnabled()) { log.debug("seek, source has top in valid range"); } } else { - source.next(); + getSource().next(); } } else { if (log.isDebugEnabled()) { @@ -353,7 +334,7 @@ public class FieldIndexIterator extends log.debug("currentRow: " + currentRow); log.debug("seek, range: " + range); } - source.seek(range, columnFamilies, inclusive); + getSource().seek(range, columnFamilies, inclusive); } } else { if (log.isDebugEnabled()) { @@ -621,18 +602,18 @@ public class FieldIndexIterator extends } Key fakeKey = new Key(new Text(currentRow + NULL_BYTE)); Range fakeRange = new Range(fakeKey, fakeKey); - source.seek(fakeRange, EMPTY_COL_FAMS, false); - if (source.hasTop()) { - return source.getTopKey().getRow(); + getSource().seek(fakeRange, EMPTY_COL_FAMS, false); + if (getSource().hasTop()) { + return getSource().getTopKey().getRow(); } else { return null; } } private Text getFirstRow() throws IOException { - source.seek(new Range(), EMPTY_COL_FAMS, false); - if (source.hasTop()) { - return source.getTopKey().getRow(); + getSource().seek(new Range(), EMPTY_COL_FAMS, false); + if (getSource().hasTop()) { + return getSource().getTopKey().getRow(); } else { throw new IOException(); } @@ -668,22 +649,22 @@ public class FieldIndexIterator extends range = r; setTopKey(null); setTopValue(null); - source.seek(range, EMPTY_COL_FAMS, false); + getSource().seek(range, EMPTY_COL_FAMS, false); while (topKey == null) { - if (source.hasTop()) { + if (getSource().hasTop()) { if (log.isDebugEnabled()) { - log.debug("jump, source has top: " + source.getTopKey()); + log.debug("jump, source has top: " + getSource().getTopKey()); } - Key k = source.getTopKey(); + Key k = getSource().getTopKey(); if (range.contains(k)) { if (matches(k)) { topKey = k; - topValue = source.getTopValue(); + topValue = getSource().getTopValue(); if (log.isDebugEnabled()) { log.debug("jump, source has top in valid range"); } } else { - source.next(); + getSource().next(); } } else { if (log.isDebugEnabled()) { @@ -740,7 +721,7 @@ public class FieldIndexIterator extends if (log.isDebugEnabled()) { log.debug("jump, new build range: " + range); } - source.seek(range, EMPTY_COL_FAMS, false); + getSource().seek(range, EMPTY_COL_FAMS, false); } } else { if (log.isDebugEnabled()) { Modified: incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java/logic/AbstractQueryLogic.java URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java/logic/AbstractQueryLogic.java?rev=1200521&r1=1200520&r2=1200521&view=diff ============================================================================== --- incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java/logic/AbstractQueryLogic.java (original) +++ incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java/logic/AbstractQueryLogic.java Thu Nov 10 20:13:25 2011 @@ -466,7 +466,6 @@ public abstract class AbstractQueryLogic StopWatch fullScanQuery = new StopWatch(); StopWatch processResults = new StopWatch(); - abstractQueryLogic.start(); StopWatch parseQuery = new StopWatch(); @@ -778,6 +777,8 @@ public abstract class AbstractQueryLogic bs.addScanIterator(si); + processResults.start(); + processResults.suspend(); long count = 0; for (Entry entry : bs) { count++; Modified: incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java/logic/ContentLogic.java URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java/logic/ContentLogic.java?rev=1200521&r1=1200520&r2=1200521&view=diff ============================================================================== --- incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java/logic/ContentLogic.java (original) +++ incubator/accumulo/trunk/contrib/accumulo_sample/query/src/main/java/logic/ContentLogic.java Thu Nov 10 20:13:25 2011 @@ -30,7 +30,6 @@ import org.jboss.util.Base64; import sample.Document; import sample.Field; import sample.Results; -import util.RegionTimer; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; @@ -74,10 +73,6 @@ public class ContentLogic { Authorizations auths = new Authorizations(StringUtils.join(authorizations, "|")); - RegionTimer timer = new RegionTimer("ContentLogic: " + query); - String section = "1) parse query"; - timer.enter(section); - Matcher match = queryPattern.matcher(query); if (!match.matches()) { throw new IllegalArgumentException("Query does not match the pattern: DOCUMENT:partitionId/wikitype/uid, your query: " + query.toString()); @@ -88,7 +83,6 @@ public class ContentLogic { log.debug("Received pieces: " + partitionId + ", " + wikitype + ", " + id); - timer.change(section = "2) creating range"); //Create the Range Key startKey = new Key(partitionId, WikipediaMapper.DOCUMENT_COLUMN_FAMILY, wikitype+NULL_BYTE+id); Key endKey = new Key(partitionId, WikipediaMapper.DOCUMENT_COLUMN_FAMILY, wikitype+NULL_BYTE+id+NULL_BYTE); @@ -96,14 +90,11 @@ public class ContentLogic { log.debug("Setting range: " + r); - timer.change(section = "3) querying table"); try { Scanner scanner = connector.createScanner(this.getTableName(), auths); scanner.setRange(r); //This should in theory only match one thing. - timer.change(section = "4) process results"); for (Entry entry : scanner) { - timer.enter("1) handle result"); Document doc = new Document(); doc.setId(id); Field val = new Field(); @@ -111,16 +102,12 @@ public class ContentLogic { val.setFieldValue(new String(Base64.decode(entry.getValue().toString()))); doc.getFields().add(val); results.getResults().add(doc); - timer.exit("1) handle result"); } } catch (TableNotFoundException e) { throw new RuntimeException("Table not found: " + this.getTableName(), e); } } - timer.exit(section); - log.info(timer.toString()); - timer = null; return results; }