incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [1/4] git commit: More prototype updates, with interactive cli.
Date Wed, 10 Oct 2012 02:01:29 GMT
Updated Branches:
  refs/heads/new-api-prototype f2b81bd0b -> 234bc49bc


More prototype updates, with interactive cli.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/234bc49b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/234bc49b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/234bc49b

Branch: refs/heads/new-api-prototype
Commit: 234bc49bcb2b909bd5bedbd636b442e2abe5213b
Parents: 5fc3afa
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Oct 9 22:00:46 2012 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Oct 9 22:00:46 2012 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/blur/core/ServerHdfs.java |   12 +-
 .../apache/blur/core/TupleStoredFieldVisitor.java  |   33 +++-
 .../blur/core/sessions/RunningQuerySession.java    |   12 +-
 .../java/org/apache/blur/parser/BqlParser.java     |    6 +-
 .../example/clients/LoadThriftClientBatch.java     |   24 +++-
 .../example/clients/ReadThriftClientBatchCli.java  |  107 ------------
 .../blur/proto/example/clients/SimpleCli.java      |  128 +++++++++++++++
 7 files changed, 202 insertions(+), 120 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/234bc49b/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/ServerHdfs.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/ServerHdfs.java
b/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/ServerHdfs.java
index 2487e3b..1ccccf5 100644
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/ServerHdfs.java
+++ b/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/ServerHdfs.java
@@ -46,6 +46,8 @@ import org.apache.blur.thrift.generated.BlurTuple.Processor;
 import org.apache.blur.thrift.generated.QuerySession;
 import org.apache.blur.thrift.generated.Session;
 import org.apache.blur.thrift.generated.Tuple;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -57,6 +59,7 @@ import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.TieredMergePolicy;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.util.Version;
@@ -67,9 +70,10 @@ import org.apache.thrift.server.TThreadPoolServer.Args;
 import org.apache.thrift.transport.TFramedTransport;
 import org.apache.thrift.transport.TServerSocket;
 import org.apache.thrift.transport.TTransportException;
-import org.mortbay.log.Log;
 
 public class ServerHdfs implements Iface {
+  
+  private static final Log LOG = LogFactory.getLog(ServerHdfs.class);
 
   private static final String XX_MAX_DIRECT_MEMORY_SIZE = "-XX:MaxDirectMemorySize=";
   private static final int MIN_SLABSIZE = 33554432;
@@ -118,10 +122,10 @@ public class ServerHdfs implements Iface {
       int slabSize = MAX_SLABSIZE;
       BlockCache cache;
       if (totalMemory < 0) {
-        Log.info("Block cache using [" + MIN_SLABSIZE + "] total memory in cache, with slab
size of [" + MIN_SLABSIZE + "].");
+        LOG.info("Block cache using [" + MIN_SLABSIZE + "] total memory in cache, with slab
size of [" + MIN_SLABSIZE + "].");
         cache = new BlockCache(false, MIN_SLABSIZE, MIN_SLABSIZE);
       } else {
-        Log.info("Block cache using [" + totalMemory + "] total memory in off heap cache,
with slab size of [" + slabSize + "].");
+        LOG.info("Block cache using [" + totalMemory + "] total memory in off heap cache,
with slab size of [" + slabSize + "].");
         cache = new BlockCache(true, totalMemory, slabSize);
       }
       BlockDirectoryCache blockDirectoryCache = new BlockDirectoryCache(cache);
@@ -166,6 +170,8 @@ public class ServerHdfs implements Iface {
   private IndexWriter openWriter(Directory directory) throws IOException {
     IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_40, new KeywordAnalyzer());
     conf.setCodec(new AppendingCodec());
+    TieredMergePolicy mergePolicy = (TieredMergePolicy) conf.getMergePolicy();
+    mergePolicy.setUseCompoundFile(false);
     return new IndexWriter(directory, conf);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/234bc49b/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/TupleStoredFieldVisitor.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/TupleStoredFieldVisitor.java
b/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/TupleStoredFieldVisitor.java
index 4a3650c..f3ba494 100644
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/TupleStoredFieldVisitor.java
+++ b/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/TupleStoredFieldVisitor.java
@@ -30,9 +30,11 @@ import org.apache.lucene.index.StoredFieldVisitor;
 
 public class TupleStoredFieldVisitor extends StoredFieldVisitor {
 
-  private final Map<String, int[]> fieldToAttributeLookup;
+  private Map<String, int[]> fieldToAttributeLookup;
   private Attribute[] attributes;
   private List<String> attributeNames;
+  private boolean allColumns;
+  private List<Attribute> allColumnsList = new ArrayList<Attribute>();
 
   public TupleStoredFieldVisitor(List<String> attributeTokens, List<String> attributeTokenAliases)
{
     if (attributeTokens.size() != attributeTokenAliases.size()) {
@@ -58,9 +60,13 @@ public class TupleStoredFieldVisitor extends StoredFieldVisitor {
     attributes = new Attribute[attributeTokens.size()];
   }
 
+  public TupleStoredFieldVisitor() {
+    allColumns = true;
+  }
+
   private Map<String, int[]> convert(Map<String, List<Integer>> map) {
     Map<String, int[]> result = new HashMap<String, int[]>();
-    for (Entry<String,List<Integer>> e : map.entrySet()) {
+    for (Entry<String, List<Integer>> e : map.entrySet()) {
       int[] array = convert(e.getValue());
       result.put(e.getKey(), array);
     }
@@ -77,6 +83,9 @@ public class TupleStoredFieldVisitor extends StoredFieldVisitor {
 
   @Override
   public Status needsField(FieldInfo fieldInfo) throws IOException {
+    if (allColumns) {
+      return Status.YES;
+    }
     int[] list = fieldToAttributeLookup.get(fieldInfo.name);
     if (list == null) {
       return Status.NO;
@@ -86,17 +95,26 @@ public class TupleStoredFieldVisitor extends StoredFieldVisitor {
 
   @Override
   public void stringField(FieldInfo fieldInfo, String value) throws IOException {
+    if (allColumns) {
+      allColumnsList.add(getStringAttribute(fieldInfo, value));
+      return;
+    }
     int[] indexes = fieldToAttributeLookup.get(fieldInfo.name);
     if (indexes == null) {
       return;
     }
+    Attribute attribute = getStringAttribute(fieldInfo, value);
+    for (int i = 0; i < indexes.length; i++) {
+      attributes[indexes[i]] = attribute;
+    }
+  }
+
+  private Attribute getStringAttribute(FieldInfo fieldInfo, String value) throws IOException
{
     Attribute attribute = new Attribute();
     attribute.setType(TYPE.STRING);
     attribute.setName(fieldInfo.name);
     attribute.setValue(value.getBytes("UTF-8"));
-    for (int i = 0; i < indexes.length; i++) {
-      attributes[indexes[i]] = attribute;
-    }
+    return attribute;
   }
 
   @Override
@@ -130,6 +148,11 @@ public class TupleStoredFieldVisitor extends StoredFieldVisitor {
 
   public List<Attribute> getTupleAndReset() {
     List<Attribute> tuple = new ArrayList<Attribute>();
+    if (allColumns) {
+      tuple.addAll(allColumnsList);
+      allColumnsList.clear();
+      return tuple;
+    }
     for (int i = 0; i < attributes.length; i++) {
       String name = attributeNames.get(i);
       tuple.add(copy(attributes[i]).setName(name));

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/234bc49b/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/sessions/RunningQuerySession.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/sessions/RunningQuerySession.java
b/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/sessions/RunningQuerySession.java
index 9336d70..9132c9d 100644
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/sessions/RunningQuerySession.java
+++ b/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/sessions/RunningQuerySession.java
@@ -1,6 +1,7 @@
 package org.apache.blur.core.sessions;
 
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.List;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
@@ -26,6 +27,7 @@ import org.apache.lucene.search.TopDocs;
 
 public class RunningQuerySession {
 
+  private static final List<String> ALL_COLUMNS = Arrays.asList("*");
   private IndexSearcher searcher;
   private TopDocs topDocs;
   private int count;
@@ -62,7 +64,11 @@ public class RunningQuerySession {
       }
       List<String> attributeTokens = bqlParser.getAttributeTokens();
       List<String> attributeTokenAliases = bqlParser.getAttributeTokenAliases();
-      fieldVistor = new TupleStoredFieldVisitor(attributeTokens, attributeTokenAliases);
+      if (attributeTokens.equals(ALL_COLUMNS)) {
+        fieldVistor = new TupleStoredFieldVisitor();
+      } else {
+        fieldVistor = new TupleStoredFieldVisitor(attributeTokens, attributeTokenAliases);
+      }
 
       List<String> orderByAttributes = bqlParser.getOrderByAttributes();
       List<OrderBy> orderByAttributesDirection = bqlParser.getOrderByAttributesDirection();
@@ -129,8 +135,8 @@ public class RunningQuerySession {
       topDocs = searcher.search(queryRewrite, fetch, sort);
     }
     long e = System.nanoTime();
-    rewriteTime = (m-s) / 1000000.0;
-    queryTime = (e-m) / 1000000.0;
+    rewriteTime = (m - s) / 1000000.0;
+    queryTime = (e - m) / 1000000.0;
     count = topDocs.totalHits;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/234bc49b/src/blur-new-api-prototype/src/main/java/org/apache/blur/parser/BqlParser.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/parser/BqlParser.java
b/src/blur-new-api-prototype/src/main/java/org/apache/blur/parser/BqlParser.java
index c602072..cefb973 100644
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/parser/BqlParser.java
+++ b/src/blur-new-api-prototype/src/main/java/org/apache/blur/parser/BqlParser.java
@@ -54,7 +54,11 @@ public class BqlParser {
   }
 
   public void parse(String queryString) throws BqlException {
-    String lowerCase = queryString.toLowerCase();
+    int end = queryString.indexOf(';');
+    if (end < 0) {
+      end = queryString.length();
+    }
+    String lowerCase = queryString.substring(0, end).toLowerCase();
     if (parseSelect(lowerCase) && parseFrom(lowerCase) && parseWhere(lowerCase)
&& parseOrderBy(lowerCase) && parserLimit(lowerCase)) {
       type = QueryType.SELECT;
       return;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/234bc49b/src/blur-new-api-prototype/src/main/java/org/apache/blur/proto/example/clients/LoadThriftClientBatch.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/proto/example/clients/LoadThriftClientBatch.java
b/src/blur-new-api-prototype/src/main/java/org/apache/blur/proto/example/clients/LoadThriftClientBatch.java
index e49767e..456ceb0 100644
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/proto/example/clients/LoadThriftClientBatch.java
+++ b/src/blur-new-api-prototype/src/main/java/org/apache/blur/proto/example/clients/LoadThriftClientBatch.java
@@ -33,6 +33,9 @@ import org.apache.thrift.TException;
 public class LoadThriftClientBatch {
 
   public static void main(String[] args) throws BlurException, TException, IOException {
+    if (args.length != 3) {
+      throw new BlurException("load <total tuple> <fields> <batch size>",
null);
+    }
     final int length = Integer.parseInt(args[0]);
     final int fields = Integer.parseInt(args[1]);
     final int batch = Integer.parseInt(args[2]);
@@ -64,7 +67,26 @@ public class LoadThriftClientBatch {
 
           Tuple tuple = new Tuple();
           for (int f = 0; f < fields; f++) {
-            tuple.addToAttributes(Util.newAttribute("id" + f, Long.toString(Math.abs(random.nextLong()))));
+            switch (f) {
+            case 0:
+              tuple.addToAttributes(Util.newAttribute("id" + f, Long.toString(Math.abs(random.nextInt(10)))));
+              break;
+            case 1:
+              tuple.addToAttributes(Util.newAttribute("id" + f, Long.toString(Math.abs(random.nextInt(100)))));
+              break;
+            case 2:
+              tuple.addToAttributes(Util.newAttribute("id" + f, Long.toString(Math.abs(random.nextInt(1000)))));
+              break;
+            case 3:
+              tuple.addToAttributes(Util.newAttribute("id" + f, Long.toString(Math.abs(random.nextInt(10000)))));
+              break;
+            case 4:
+              tuple.addToAttributes(Util.newAttribute("id" + f, Long.toString(Math.abs(random.nextInt(100000)))));
+              break;
+            default:
+              tuple.addToAttributes(Util.newAttribute("id" + f, Long.toString(Math.abs(random.nextLong()))));
+              break;
+            }
           }
           tuples.add(tuple);
           if (tuples.size() >= batch) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/234bc49b/src/blur-new-api-prototype/src/main/java/org/apache/blur/proto/example/clients/ReadThriftClientBatchCli.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/proto/example/clients/ReadThriftClientBatchCli.java
b/src/blur-new-api-prototype/src/main/java/org/apache/blur/proto/example/clients/ReadThriftClientBatchCli.java
deleted file mode 100644
index bbcde98..0000000
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/proto/example/clients/ReadThriftClientBatchCli.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.apache.blur.proto.example.clients;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.List;
-
-import org.apache.blur.core.Util;
-import org.apache.blur.thrift.ClientManager;
-import org.apache.blur.thrift.Command;
-import org.apache.blur.thrift.generated.BlurException;
-import org.apache.blur.thrift.generated.BlurTuple.Client;
-import org.apache.blur.thrift.generated.QuerySession;
-import org.apache.blur.thrift.generated.Session;
-import org.apache.blur.thrift.generated.Tuple;
-import org.apache.thrift.TException;
-
-public class ReadThriftClientBatchCli {
-
-  public static void main(String[] args) throws BlurException, TException, IOException {
-    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
-    String line;
-    System.out.print(">");
-    System.out.flush();
-    while ((line = reader.readLine()) != null) {
-      executeQuery(line.trim());
-      System.out.print(">");
-      System.out.flush();
-    }
-  }
-
-  private static void executeQuery(final String q) throws BlurException, TException, IOException
{
-    ClientManager.execute("localhost:9000", new Command<Void>() {
-      @Override
-      public Void call(Client client) throws BlurException, TException {
-        Session session = client.openReadSession();
-        QuerySession querySession = client.executeQuery(session, q);
-        while (true) {
-          List<Tuple> metaDataResults = client.nextMetaDataResults(querySession, 100);
-          if (metaDataResults.isEmpty()) {
-            break;
-          }
-          for (Tuple tuple : metaDataResults) {
-            System.out.println(Util.toString(tuple));
-          }
-        }
-
-        long count = 0;
-        long total = 0;
-        long start = System.nanoTime();
-        long attributeCount = 0;
-        long attributeTotal = 0;
-        while (true) {
-          long now = System.nanoTime();
-          if (start + 5000000000L < now) {
-            double seconds = (now - start) / 1000000000.0;
-            double rate = count / seconds;
-            double attributeRate = attributeCount / seconds;
-            System.out.println("Tuple count [" + total + "] at [" + rate + "/s] Attribute
Count [" + attributeTotal + "] at [" + attributeRate + "/s]");
-            start = System.nanoTime();
-            count = 0;
-            attributeCount = 0;
-          }
-          List<Tuple> results = client.nextResults(querySession, 100);
-          if (results.isEmpty()) {
-            break;
-          }
-          for (Tuple tuple : results) {
-            System.out.println(Util.toString(tuple));
-          }
-          count += results.size();
-          total += results.size();
-          int atCount = 0;
-          for (Tuple t : results) {
-            atCount += t.getAttributes().size();
-          }
-          attributeCount += atCount;
-          attributeTotal += atCount;
-        }
-        client.closeReadSession(session);
-
-        long now = System.nanoTime();
-        double seconds = (now - start) / 1000000000.0;
-        double rate = count / seconds;
-        double attributeRate = attributeCount / seconds;
-        System.out.println("Tuple count [" + total + "] at [" + rate + "/s] Attribute Count
[" + attributeTotal + "] at [" + attributeRate + "/s]");
-        return null;
-      }
-    });
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/234bc49b/src/blur-new-api-prototype/src/main/java/org/apache/blur/proto/example/clients/SimpleCli.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/proto/example/clients/SimpleCli.java
b/src/blur-new-api-prototype/src/main/java/org/apache/blur/proto/example/clients/SimpleCli.java
new file mode 100644
index 0000000..d2b1216
--- /dev/null
+++ b/src/blur-new-api-prototype/src/main/java/org/apache/blur/proto/example/clients/SimpleCli.java
@@ -0,0 +1,128 @@
+package org.apache.blur.proto.example.clients;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.blur.core.Util;
+import org.apache.blur.thrift.ClientManager;
+import org.apache.blur.thrift.Command;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.blur.thrift.generated.BlurTuple.Client;
+import org.apache.blur.thrift.generated.QuerySession;
+import org.apache.blur.thrift.generated.Session;
+import org.apache.blur.thrift.generated.Tuple;
+import org.apache.thrift.TException;
+
+public class SimpleCli {
+
+  public static void main(String[] args) throws IOException, TException {
+    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
+    String line;
+    System.out.print(">");
+    System.out.flush();
+    while ((line = reader.readLine()) != null) {
+      String trim = line.trim();
+      if (!trim.isEmpty()) {
+        if (trim.startsWith("load")) {
+          List<String> strArgs = new ArrayList<String>(Arrays.asList(trim.split("
")));
+          strArgs.remove("load");
+          try {
+            LoadThriftClientBatch.main(strArgs.toArray(new String[] {}));
+          } catch (BlurException e) {
+            System.err.println(e.getMessage());
+            System.err.println();
+          }
+        } else {
+          try {
+            executeQuery(trim);
+          } catch (BlurException e) {
+            System.err.println(e.getMessage());
+            System.err.println();
+          }
+        }
+      }
+      System.out.print(">");
+      System.out.flush();
+    }
+  }
+
+  private static void executeQuery(final String q) throws BlurException, TException, IOException
{
+    ClientManager.execute("localhost:9000", new Command<Void>() {
+      @Override
+      public Void call(Client client) throws BlurException, TException {
+        Session session = client.openReadSession();
+        QuerySession querySession = client.executeQuery(session, q);
+        while (true) {
+          List<Tuple> metaDataResults = client.nextMetaDataResults(querySession, 100);
+          if (metaDataResults.isEmpty()) {
+            break;
+          }
+          for (Tuple tuple : metaDataResults) {
+            System.out.println(Util.toString(tuple));
+          }
+        }
+
+        long count = 0;
+        long total = 0;
+        long start = System.nanoTime();
+        long attributeCount = 0;
+        long attributeTotal = 0;
+        while (true) {
+          long now = System.nanoTime();
+          if (start + 5000000000L < now) {
+            double seconds = (now - start) / 1000000000.0;
+            double rate = count / seconds;
+            double attributeRate = attributeCount / seconds;
+            System.out.println("Tuple count [" + total + "] at [" + rate + "/s] Attribute
Count [" + attributeTotal + "] at [" + attributeRate + "/s]");
+            start = System.nanoTime();
+            count = 0;
+            attributeCount = 0;
+          }
+          List<Tuple> results = client.nextResults(querySession, 100);
+          if (results.isEmpty()) {
+            break;
+          }
+          for (Tuple tuple : results) {
+            System.out.println(Util.toString(tuple));
+          }
+          count += results.size();
+          total += results.size();
+          int atCount = 0;
+          for (Tuple t : results) {
+            atCount += t.getAttributes().size();
+          }
+          attributeCount += atCount;
+          attributeTotal += atCount;
+        }
+        client.closeReadSession(session);
+
+        long now = System.nanoTime();
+        double seconds = (now - start) / 1000000000.0;
+        double rate = count / seconds;
+        double attributeRate = attributeCount / seconds;
+        System.out.println("Tuple count [" + total + "] at [" + rate + "/s] Attribute Count
[" + attributeTotal + "] at [" + attributeRate + "/s]");
+        return null;
+      }
+    });
+  }
+}


Mime
View raw message