gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djkevi...@apache.org
Subject [29/32] gora git commit: Update the query results to get the progress for aerospike module
Date Thu, 27 Jul 2017 18:45:55 GMT
Update the query results to get the progress for aerospike module


Project: http://git-wip-us.apache.org/repos/asf/gora/repo
Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/c0aa76eb
Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/c0aa76eb
Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/c0aa76eb

Branch: refs/heads/master
Commit: c0aa76eb16031973f3e897ea535a0b38bfb7f11f
Parents: 360c604
Author: nishadi <ndimeshi@gmail.com>
Authored: Thu Jul 27 10:18:13 2017 +0530
Committer: nishadi <ndimeshi@gmail.com>
Committed: Thu Jul 27 10:18:13 2017 +0530

----------------------------------------------------------------------
 .../gora/aerospike/query/AerospikeQueryResult.java | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/c0aa76eb/gora-aerospike/src/main/java/org/apache/gora/aerospike/query/AerospikeQueryResult.java
----------------------------------------------------------------------
diff --git a/gora-aerospike/src/main/java/org/apache/gora/aerospike/query/AerospikeQueryResult.java
b/gora-aerospike/src/main/java/org/apache/gora/aerospike/query/AerospikeQueryResult.java
index e135dc3..c843082 100644
--- a/gora-aerospike/src/main/java/org/apache/gora/aerospike/query/AerospikeQueryResult.java
+++ b/gora-aerospike/src/main/java/org/apache/gora/aerospike/query/AerospikeQueryResult.java
@@ -17,8 +17,6 @@
  */
 package org.apache.gora.aerospike.query;
 
-import com.aerospike.client.Record;
-import com.aerospike.client.query.RecordSet;
 import org.apache.gora.aerospike.store.AerospikeStore;
 import org.apache.gora.persistency.Persistent;
 import org.apache.gora.query.Query;
@@ -26,7 +24,6 @@ import org.apache.gora.query.impl.ResultBase;
 import org.apache.gora.store.DataStore;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -46,10 +43,20 @@ public class AerospikeQueryResult<K, T extends Persistent> extends
ResultBase<K,
     this.fields = fields;
   }
 
+  /**
+   * {@inheritDoc}
+   *
+   * @return a float value representing progress of the job
+   * @throws IOException          if there is an error obtaining progress
+   * @throws InterruptedException if progress stalls or is interrupted
+   */
   @Override
   public float getProgress() throws IOException, InterruptedException {
-    //ToDo: to be implemented
-    return 0;
+    if (resultRecords != null && resultRecords.size() > 0) {
+      return (float) offset / (float) resultRecords.size();
+    } else {
+      return 0;
+    }
   }
 
   /**


Mime
View raw message