Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 28EFFE0D2 for ; Mon, 18 Mar 2013 12:03:27 +0000 (UTC) Received: (qmail 81748 invoked by uid 500); 18 Mar 2013 12:03:27 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 81630 invoked by uid 500); 18 Mar 2013 12:03:24 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 81597 invoked by uid 99); 18 Mar 2013 12:03:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Mar 2013 12:03:23 +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; Mon, 18 Mar 2013 12:03:20 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4A7E12388962; Mon, 18 Mar 2013 12:02:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1457724 - in /accumulo/branches/1.5/proxy/src: main/java/org/apache/accumulo/proxy/ProxyServer.java test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java Date: Mon, 18 Mar 2013 12:02:59 -0000 To: commits@accumulo.apache.org From: ecn@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130318120259.4A7E12388962@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ecn Date: Mon Mar 18 12:02:58 2013 New Revision: 1457724 URL: http://svn.apache.org/r1457724 Log: ACCUMULO-1183 applying patch from Corey Nolet Modified: accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java Modified: accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java?rev=1457724&r1=1457723&r2=1457724&view=diff ============================================================================== --- accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java (original) +++ accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java Mon Mar 18 12:02:58 2013 @@ -819,7 +819,17 @@ public class ProxyServer implements Accu } } scanner.setRanges(ranges); + + if (opts.columns != null) { + for (ScanColumn col : opts.columns) { + if (col.isSetColQualifier()) + scanner.fetchColumn(ByteBufferUtil.toText(col.colFamily), ByteBufferUtil.toText(col.colQualifier)); + else + scanner.fetchColumnFamily(ByteBufferUtil.toText(col.colFamily)); + } + } } + UUID uuid = UUID.randomUUID(); ScannerPlusIterator spi = new ScannerPlusIterator(); Modified: accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java?rev=1457724&r1=1457723&r2=1457724&view=diff ============================================================================== --- accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java (original) +++ accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java Mon Mar 18 12:02:58 2013 @@ -31,6 +31,7 @@ import java.util.TreeMap; import org.apache.accumulo.core.iterators.user.RegExFilter; import org.apache.accumulo.proxy.thrift.BatchScanOptions; import org.apache.accumulo.proxy.thrift.ColumnUpdate; +import org.apache.accumulo.proxy.thrift.ScanColumn; import org.apache.accumulo.proxy.thrift.IteratorSetting; import org.apache.accumulo.proxy.thrift.Key; import org.apache.accumulo.proxy.thrift.KeyValue; @@ -139,7 +140,92 @@ public class TestProxyReadWrite { } assertEquals(i, 50000); } - + + /** + * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a columnFamily so only the entries with specified column family come back (there should be + * 50,000) + * + * @throws Exception + */ + @Test + public void readWriteBatchOneShotWithColumnFamilyOnly() throws Exception { + int maxInserts = 100000; + Map> mutations = new HashMap>(); + String format = "%1$05d"; + for (int i = 0; i < maxInserts; i++) { + + addMutation(mutations, String.format(format, i), "cf" + (i % 2) , "cq" + (i % 2), Util.randString(10)); + + if (i % 1000 == 0 || i == maxInserts - 1) { + tpc.proxy().updateAndFlush(userpass, testtable, mutations); + mutations.clear(); + } + } + + BatchScanOptions options = new BatchScanOptions(); + + ScanColumn sc = new ScanColumn(); + sc.colFamily = ByteBuffer.wrap("cf0".getBytes()); + + options.columns = Collections.singletonList(sc); + String cookie = tpc.proxy().createBatchScanner(userpass, testtable, options); + + int i = 0; + boolean hasNext = true; + + int k = 1000; + while (hasNext) { + ScanResult kvList = tpc.proxy().nextK(cookie, k); + i += kvList.getResultsSize(); + hasNext = kvList.isMore(); + } + assertEquals(i, 50000); + } + + + /** + * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a columnFamily + columnQualififer so only the entries with specified column + * come back (there should be 50,000) + * + * @throws Exception + */ + @Test + public void readWriteBatchOneShotWithFullColumn() throws Exception { + int maxInserts = 100000; + Map> mutations = new HashMap>(); + String format = "%1$05d"; + for (int i = 0; i < maxInserts; i++) { + + addMutation(mutations, String.format(format, i), "cf" + (i % 2) , "cq" + (i % 2), Util.randString(10)); + + if (i % 1000 == 0 || i == maxInserts - 1) { + tpc.proxy().updateAndFlush(userpass, testtable, mutations); + mutations.clear(); + } + } + + BatchScanOptions options = new BatchScanOptions(); + + ScanColumn sc = new ScanColumn(); + sc.colFamily = ByteBuffer.wrap("cf0".getBytes()); + sc.colQualifier = ByteBuffer.wrap("cq0".getBytes()); + + options.columns = Collections.singletonList(sc); + String cookie = tpc.proxy().createBatchScanner(userpass, testtable, options); + + int i = 0; + boolean hasNext = true; + + int k = 1000; + while (hasNext) { + ScanResult kvList = tpc.proxy().nextK(cookie, k); + i += kvList.getResultsSize(); + hasNext = kvList.isMore(); + } + assertEquals(i, 50000); + } + + /** * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Filter the results so only the even numbers come back. *