ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject incubator-ignite git commit: ignite-sql-old - benchmarks fixed
Date Sun, 15 Feb 2015 17:54:59 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/sprint-1 92e2bc0e1 -> 70c50f526


ignite-sql-old - benchmarks fixed


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/70c50f52
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/70c50f52
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/70c50f52

Branch: refs/heads/sprint-1
Commit: 70c50f526af009f6f54d98770dd98eae9ac99ce6
Parents: 92e2bc0
Author: S.Vladykin <svladykin@gridgain.com>
Authored: Sun Feb 15 20:52:44 2015 +0300
Committer: S.Vladykin <svladykin@gridgain.com>
Committed: Sun Feb 15 20:52:44 2015 +0300

----------------------------------------------------------------------
 .../cache/IgniteSqlQueryBenchmark.java          | 22 ++++++++---------
 .../cache/IgniteSqlQueryJoinBenchmark.java      | 26 +++++++++-----------
 .../cache/IgniteSqlQueryPutBenchmark.java       | 22 ++++++++---------
 3 files changed, 32 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/70c50f52/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java
index ab25220..e26ab9f 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java
@@ -18,10 +18,11 @@
 package org.apache.ignite.yardstick.cache;
 
 import org.apache.ignite.*;
-import org.apache.ignite.internal.processors.cache.query.*;
+import org.apache.ignite.cache.query.*;
 import org.apache.ignite.yardstick.cache.model.*;
 import org.yardstickframework.*;
 
+import javax.cache.*;
 import java.util.*;
 import java.util.concurrent.*;
 
@@ -31,9 +32,6 @@ import static org.yardstickframework.BenchmarkUtils.*;
  * Ignite benchmark that performs query operations.
  */
 public class IgniteSqlQueryBenchmark extends IgniteCacheAbstractBenchmark {
-    /** */
-    private CacheQuery qry;
-
     /** {@inheritDoc} */
     @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
         super.setUp(cfg);
@@ -52,8 +50,6 @@ public class IgniteSqlQueryBenchmark extends IgniteCacheAbstractBenchmark
{
         }
 
         println(cfg, "Finished populating query data in " + ((System.nanoTime() - start)
/ 1_000_000) + " ms.");
-
-        qry = null; // TODO: should be fixed after IGNITE-2 cache.queries().createSqlQuery(Person.class,
"salary >= ? and salary <= ?");
     }
 
     /** {@inheritDoc} */
@@ -62,10 +58,10 @@ public class IgniteSqlQueryBenchmark extends IgniteCacheAbstractBenchmark
{
 
         double maxSalary = salary + 1000;
 
-        Collection<Map.Entry<Integer, Person>> entries = executeQuery(salary,
maxSalary);
+        Collection<Cache.Entry<Integer, Object>> entries = executeQuery(salary,
maxSalary);
 
-        for (Map.Entry<Integer, Person> entry : entries) {
-            Person p = entry.getValue();
+        for (Cache.Entry<Integer, Object> entry : entries) {
+            Person p = (Person)entry.getValue();
 
             if (p.getSalary() < salary || p.getSalary() > maxSalary)
                 throw new Exception("Invalid person retrieved [min=" + salary + ", max="
+ maxSalary +
@@ -81,10 +77,12 @@ public class IgniteSqlQueryBenchmark extends IgniteCacheAbstractBenchmark
{
      * @return Query result.
      * @throws Exception If failed.
      */
-    private Collection<Map.Entry<Integer, Person>> executeQuery(double minSalary,
double maxSalary) throws Exception {
-        CacheQuery<Map.Entry<Integer, Person>> q = (CacheQuery<Map.Entry<Integer,
Person>>)qry;
+    private Collection<Cache.Entry<Integer, Object>> executeQuery(double minSalary,
double maxSalary) throws Exception {
+        SqlQuery qry = new SqlQuery(Person.class, "salary >= ? and salary <= ?");
+
+        qry.setArgs(minSalary, maxSalary);
 
-        return q.execute(minSalary, maxSalary).get();
+        return cache.query(qry).getAll();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/70c50f52/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmark.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmark.java
index 7b81615..4e34d14 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmark.java
@@ -18,7 +18,7 @@
 package org.apache.ignite.yardstick.cache;
 
 import org.apache.ignite.*;
-import org.apache.ignite.internal.processors.cache.query.*;
+import org.apache.ignite.cache.query.*;
 import org.apache.ignite.yardstick.cache.model.*;
 import org.yardstickframework.*;
 
@@ -31,9 +31,6 @@ import static org.yardstickframework.BenchmarkUtils.*;
  * Ignite benchmark that performs query operations with joins.
  */
 public class IgniteSqlQueryJoinBenchmark extends IgniteCacheAbstractBenchmark {
-    /** */
-    private CacheQuery qry;
-
     /** {@inheritDoc} */
     @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
         super.setUp(cfg);
@@ -52,9 +49,8 @@ public class IgniteSqlQueryJoinBenchmark extends IgniteCacheAbstractBenchmark
{
             dataLdr.flush();
 
             // Populate persons.
-            for (int i = 0; i < args.range() && !Thread.currentThread().isInterrupted();
i++) {
-                Person p =
-                    new Person(i, ThreadLocalRandom.current().nextInt(orgRange), "firstName"
+ i, "lastName" + i, i * 1000);
+            for (int i = orgRange; i < orgRange + args.range() && !Thread.currentThread().isInterrupted();
i++) {
+                Person p = new Person(i, nextRandom(orgRange), "firstName" + i, "lastName"
+ i, (i - orgRange) * 1000);
 
                 dataLdr.addData(i, p);
 
@@ -64,11 +60,6 @@ public class IgniteSqlQueryJoinBenchmark extends IgniteCacheAbstractBenchmark
{
         }
 
         println(cfg, "Finished populating join query data in " + ((System.nanoTime() - start)
/ 1_000_000) + " ms.");
-
-        qry = null; // TODO: should be fixed after IGNITE-2 cache.queries().createSqlFieldsQuery(
-            // "select p.id, p.orgId, p.firstName, p.lastName, p.salary, o.name " +
-            //    "from Person p, Organization o " +
-            //    "where p.id = o.id and salary >= ? and salary <= ?");
     }
 
     /** {@inheritDoc} */
@@ -106,9 +97,16 @@ public class IgniteSqlQueryJoinBenchmark extends IgniteCacheAbstractBenchmark
{
      * @throws Exception If failed.
      */
     private Collection<List<?>> executeQueryJoin(double minSalary, double maxSalary)
throws Exception {
-        CacheQuery<List<?>> q = (CacheQuery<List<?>>)qry;
+        SqlFieldsQuery qry = new SqlFieldsQuery(
+            "select p.id, p.orgId, p.firstName, p.lastName, p.salary, o.name " +
+            "from Person p " +
+            "left join Organization o " +
+            "on p.id = o.id " +
+            "where salary >= ? and salary <= ?");
+
+        qry.setArgs(minSalary, maxSalary);
 
-        return q.execute(minSalary, maxSalary).get();
+        return cache.queryFields(qry).getAll();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/70c50f52/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java
index e8bf089..9f1e136 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java
@@ -18,10 +18,11 @@
 package org.apache.ignite.yardstick.cache;
 
 import org.apache.ignite.*;
-import org.apache.ignite.internal.processors.cache.query.*;
+import org.apache.ignite.cache.query.*;
 import org.apache.ignite.yardstick.cache.model.*;
 import org.yardstickframework.*;
 
+import javax.cache.*;
 import java.util.*;
 import java.util.concurrent.*;
 
@@ -29,14 +30,9 @@ import java.util.concurrent.*;
  * Ignite benchmark that performs put and query operations.
  */
 public class IgniteSqlQueryPutBenchmark extends IgniteCacheAbstractBenchmark {
-    /** */
-    private CacheQuery qry;
-
     /** {@inheritDoc} */
     @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
         super.setUp(cfg);
-
-        qry = null; // TODO: should be fixed after IGNITE-2 cache.queries().createSqlQuery(Person.class,
"salary >= ? and salary <= ?");
     }
 
     /** {@inheritDoc} */
@@ -48,10 +44,10 @@ public class IgniteSqlQueryPutBenchmark extends IgniteCacheAbstractBenchmark
{
 
             double maxSalary = salary + 1000;
 
-            Collection<Map.Entry<Integer, Person>> entries = executeQuery(salary,
maxSalary);
+            Collection<Cache.Entry<Integer, Object>> entries = executeQuery(salary,
maxSalary);
 
-            for (Map.Entry<Integer, Person> entry : entries) {
-                Person p = entry.getValue();
+            for (Cache.Entry<Integer, Object> entry : entries) {
+                Person p = (Person)entry.getValue();
 
                 if (p.getSalary() < salary || p.getSalary() > maxSalary)
                     throw new Exception("Invalid person retrieved [min=" + salary + ", max="
+ maxSalary +
@@ -73,10 +69,12 @@ public class IgniteSqlQueryPutBenchmark extends IgniteCacheAbstractBenchmark
{
      * @return Query result.
      * @throws Exception If failed.
      */
-    private Collection<Map.Entry<Integer, Person>> executeQuery(double minSalary,
double maxSalary) throws Exception {
-        CacheQuery<Map.Entry<Integer, Person>> q = (CacheQuery<Map.Entry<Integer,
Person>>)qry;
+    private Collection<Cache.Entry<Integer, Object>> executeQuery(double minSalary,
double maxSalary) throws Exception {
+        SqlQuery qry = new SqlQuery(Person.class, "salary >= ? and salary <= ?");
+
+        qry.setArgs(minSalary, maxSalary);
 
-        return q.execute(minSalary, maxSalary).get();
+        return cache.query(qry).getAll();
     }
 
     /** {@inheritDoc} */


Mime
View raw message