You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/03/22 12:38:48 UTC

ignite git commit: IGNITE-1232: H2CompareBigQueryDistributedJoinsTest

Repository: ignite
Updated Branches:
  refs/heads/ignite-1232 abdd443b5 -> a48e40317


IGNITE-1232: H2CompareBigQueryDistributedJoinsTest


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

Branch: refs/heads/ignite-1232
Commit: a48e4031758ea0aa76034e1306d9e18ebe8abb70
Parents: abdd443
Author: ashutak <as...@gridgain.com>
Authored: Tue Mar 22 14:39:00 2016 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Tue Mar 22 14:39:00 2016 +0300

----------------------------------------------------------------------
 .../H2CompareBigQueryDistributedJoinsTest.java  | 28 +++++++++
 .../query/h2/sql/H2CompareBigQueryTest.java     | 66 ++++++++++----------
 .../IgniteCacheQuerySelfTestSuite.java          |  2 +
 3 files changed, 64 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a48e4031/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryDistributedJoinsTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryDistributedJoinsTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryDistributedJoinsTest.java
new file mode 100644
index 0000000..267778f
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryDistributedJoinsTest.java
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.internal.processors.query.h2.sql;
+
+/**
+ * Executes SQL big query test using distributed joins mode.
+ */
+public class H2CompareBigQueryDistributedJoinsTest extends H2CompareBigQueryTest {
+    /** {@inheritDoc} */
+    @Override protected boolean distributedJoins() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/a48e4031/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryTest.java
index 24e4fe3..17453e8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryTest.java
@@ -103,6 +103,20 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest {
         return res;
     }
 
+    /**
+     * @return Use colocated data.
+     */
+    private boolean useColocatedData() {
+        return !distributedJoins();
+    }
+
+    /**
+     * @return Whehter to use distrubutedJoins or not.
+     */
+    protected boolean distributedJoins() {
+        return false;
+    }
+
     /** {@inheritDoc} */
     @Override protected void setIndexedTypes(CacheConfiguration<?, ?> cc, CacheMode mode) {
         if (mode == CacheMode.PARTITIONED)
@@ -162,7 +176,7 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest {
 
                 add(op);
 
-                pCache.put(op.key(), op);
+                pCache.put(op.key(useColocatedData()), op);
 
                 insertInDb(op);
             }
@@ -176,7 +190,7 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest {
 
                     add(replace);
 
-                    pCache.put(replace.key(), replace);
+                    pCache.put(replace.key(useColocatedData()), replace);
 
                     insertInDb(replace);
                 }
@@ -191,7 +205,7 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest {
 
                     add(c);
 
-                    pCache.put(c.key(), c);
+                    pCache.put(c.key(useColocatedData()), c);
 
                     insertInDb(c);
                 }
@@ -232,22 +246,7 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest {
      * @throws Exception If failed.
      */
     public void testBigQuery() throws Exception {
-        checkBigQuery(false);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testBigQueryDistributed() throws Exception {
-        checkBigQuery(true);
-    }
-
-    /**
-     * @throws Exception If failed.
-     * @param distributedJoins Use distributed joins flag.
-     */
-    public void checkBigQuery(boolean distributedJoins) throws Exception {
-        List<List<?>> res = compareQueryRes0(pCache, bigQry, distributedJoins, new Object[0], Ordering.RANDOM);
+        List<List<?>> res = compareQueryRes0(pCache, bigQry, distributedJoins(), new Object[0], Ordering.RANDOM);
 
         assertTrue(!res.isEmpty()); // Ensure we set good testing data at database.
     }
@@ -351,7 +350,7 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest {
                 "values(?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
             int i = 0;
 
-            st.setObject(++i, o.key());
+            st.setObject(++i, o.key(useColocatedData()));
             st.setObject(++i, o);
             st.setObject(++i, o.id);
             st.setObject(++i, o.orderId);
@@ -375,7 +374,7 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest {
             "insert into \"part\".OrderParams (_key, _val, id, date, orderId, parentAlgo) values(?, ?, ?, ?, ?, ?)")) {
             int i = 0;
 
-            st.setObject(++i, o.key());
+            st.setObject(++i, o.key(useColocatedData()));
             st.setObject(++i, o);
             st.setObject(++i, o.id);
             st.setObject(++i, o.date);
@@ -396,7 +395,7 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest {
             "insert into \"part\".Cancel (_key, _val, id, date, refOrderId) values(?, ?, ?, ?, ?)")) {
             int i = 0;
 
-            st.setObject(++i, o.key());
+            st.setObject(++i, o.key(useColocatedData()));
             st.setObject(++i, o);
             st.setObject(++i, o.id);
             st.setObject(++i, o.date);
@@ -533,10 +532,11 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest {
         }
 
         /**
-         * @return Afinity key.
+         * @param useColocatedData Use colocated data.
+         * @return Key.
          */
-        public AffinityKey<Integer> key() {
-            return new AffinityKey<>(id, orderId);
+        public Object key(boolean useColocatedData) {
+            return useColocatedData ? new AffinityKey<>(id, orderId) : id;
         }
 
         /** {@inheritDoc} */
@@ -584,10 +584,11 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest {
         }
 
         /**
-         * @return Afinity key.
+         * @param useColocatedData Use colocated data.*
+         * @return Key.
          */
-        public AffinityKey<Integer> key() {
-            return new AffinityKey<>(id, orderId);
+        public Object key(boolean useColocatedData) {
+            return useColocatedData ? new AffinityKey<>(id, orderId) : id;
         }
 
         /** {@inheritDoc} */
@@ -618,7 +619,7 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest {
         private Date date;
 
         /**
-         * @param id
+         * @param id ID.
          * @param refOrderId Reference order id.
          * @param date Date.
          */
@@ -629,10 +630,11 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest {
         }
 
         /**
-         * @return Afinity key.
+         * @param useColocatedData Use colocated data.
+         * @return Key.
          */
-        public AffinityKey<Integer> key() {
-            return new AffinityKey<>(id, refOrderId);
+        public Object key(boolean useColocatedData) {
+            return useColocatedData ? new AffinityKey<>(id, refOrderId) : id;
         }
 
         /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/a48e4031/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index d111381..6b216a1 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -118,6 +118,7 @@ import org.apache.ignite.internal.processors.query.IgniteSqlSchemaIndexingTest;
 import org.apache.ignite.internal.processors.query.IgniteSqlSplitterSelfTest;
 import org.apache.ignite.internal.processors.query.h2.sql.BaseH2CompareQueryTest;
 import org.apache.ignite.internal.processors.query.h2.sql.GridQueryParsingTest;
+import org.apache.ignite.internal.processors.query.h2.sql.H2CompareBigQueryDistributedJoinsTest;
 import org.apache.ignite.internal.processors.query.h2.sql.H2CompareBigQueryTest;
 import org.apache.ignite.spi.communication.tcp.GridOrderedMessageCancelSelfTest;
 
@@ -241,6 +242,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
         // Ignite cache and H2 comparison.
         suite.addTestSuite(BaseH2CompareQueryTest.class);
         suite.addTestSuite(H2CompareBigQueryTest.class);
+        suite.addTestSuite(H2CompareBigQueryDistributedJoinsTest.class);
 
         // Cache query metrics.
         suite.addTestSuite(CacheLocalQueryMetricsSelfTest.class);