Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1B81E175EA for ; Mon, 6 Apr 2015 19:13:12 +0000 (UTC) Received: (qmail 2199 invoked by uid 500); 6 Apr 2015 19:13:12 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 2178 invoked by uid 500); 6 Apr 2015 19:13:11 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 2169 invoked by uid 99); 6 Apr 2015 19:13:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Apr 2015 19:13:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 06 Apr 2015 19:13:10 +0000 Received: (qmail 1607 invoked by uid 99); 6 Apr 2015 19:12:50 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Apr 2015 19:12:50 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 057E9E10A9; Mon, 6 Apr 2015 19:12:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: incubator-ignite git commit: ignite-437: h2 execute big query Date: Mon, 6 Apr 2015 19:12:49 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org Repository: incubator-ignite Updated Branches: refs/heads/ignite-437-sqltests-p2 a577e89bc -> 3dbd6f896 ignite-437: h2 execute big query Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3dbd6f89 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3dbd6f89 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3dbd6f89 Branch: refs/heads/ignite-437-sqltests-p2 Commit: 3dbd6f8966d900096ce59fdd68fcb51b9972520b Parents: a577e89 Author: Artem Shutak Authored: Mon Apr 6 22:12:56 2015 +0300 Committer: Artem Shutak Committed: Mon Apr 6 22:12:56 2015 +0300 ---------------------------------------------------------------------- .../h2/sql/AbstractH2CompareQueryTest.java | 2 +- .../query/h2/sql/H2CompareBigQueryTest.java | 103 +++++++++++++++---- 2 files changed, 82 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbd6f89/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/AbstractH2CompareQueryTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/AbstractH2CompareQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/AbstractH2CompareQueryTest.java index 1df9887..637174d 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/AbstractH2CompareQueryTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/AbstractH2CompareQueryTest.java @@ -231,7 +231,7 @@ public abstract class AbstractH2CompareQueryTest extends GridCommonAbstractTest assertRsEquals(h2Res, cacheRes, ordering); - return cacheRes; + return h2Res; } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbd6f89/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 b172e97..93a11cc 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 @@ -33,15 +33,18 @@ import java.util.concurrent.atomic.*; * * mixed ignite caches (replicated and partitioned) which have the same data models and data content. */ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { - private static final int ROOT_ORDER_CNT = 1; + /** Root order count. */ + private static final int ROOT_ORDER_CNT = 1000; + + /** Dates count. */ private static final int DATES_CNT = 5; /** Big repitable select of the big query. */ private static final String BSELECT = - " select date, orderId, rootOrderId, origOrderId, archSeq \n" + + " select date, orderId, rootOrderId, origOrderId, archSeq, alias \n" + " from \"part\".CustOrder where alias='CUSTOM'\n" + " union all\n" + - " select date, orderId, rootOrderId, origOrderId, archSeq \n" + + " select date, orderId, refOrderId as origOrderId, rootOrderId, archSeq, alias \n" + " from \"part\".ReplaceOrder where alias='CUSTOM'"; /** Big query "cop" part. */ @@ -50,10 +53,14 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { " op.parentAlgo\n" + " from (\n" + indent1(BSELECT) + - " ) co, OrderParams op\n" + - " where co.date = op.date and co.orderId = op.orderId and dateToLong(co.date)+co.archSeq =\n" + + " ) co, \"part\".OrderParams op\n" + + " where co.date = op.date and co.orderId = op.orderId and " + +// "dateToLong(co.date)+" + + " co.archSeq =\n" + " (\n" + - " select max(dateToLong(date)+archSeq) \n" + + " select max(" + +// "dateToLong(date)+" + + " archSeq) \n" + " from (\n" + indent4(BSELECT) + " ) \n" + @@ -71,7 +78,7 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { /** Big query "cc" part. */ private static final String BQ_CC = - " select top 1 refOrderId, date from Cancel"; + " select top 1 refOrderId, date from \"part\".Cancel"; /** Full the big query. */ private static final String BIG_QUERY = @@ -166,7 +173,7 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { int orderId = idGen.incrementAndGet(); CustOrder order = new CustOrder(orderId, rootOrderId, dates.get(orderId % dates.size()) , - orderId % 2 == 0 ? "CUSTOM" : "OTHER"); + orderId % 2 == 0 ? "CUSTOM" : "OTHER", orderId); add(order); @@ -194,7 +201,7 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { for (CustOrder o : ords) { if (o.orderId % 7 == 0) { ReplaceOrder replace = new ReplaceOrder(idGen.incrementAndGet(), o.orderId, o.rootOrderId, o.alias, - new Date(o.date.getTime() + 12 * 60 * 60 * 1000)); // Plus a half of day. + new Date(o.date.getTime() + 12 * 60 * 60 * 1000), o.orderId); // Plus a half of day. add(replace); @@ -241,8 +248,10 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { * @throws Exception If failed. */ @Override protected void checkAllDataEquals() throws Exception { - compareQueryRes0("select _key, _val, date, orderId, rootOrderId, alias from \"part\".CustOrder");// , archSeq - compareQueryRes0("select _key, _val, id, date, orderId, rootOrderId, alias from \"part\".ReplaceOrder");// , archSeq + compareQueryRes0("select _key, _val, date, orderId, rootOrderId, alias, archSeq, origOrderId " + + "from \"part\".CustOrder"); + compareQueryRes0("select _key, _val, id, date, orderId, rootOrderId, alias, archSeq, refOrderId " + + "from \"part\".ReplaceOrder"); compareQueryRes0("select _key, _val, id, date, orderId, parentAlgo from \"part\".OrderParams\n"); compareQueryRes0("select _key, _val, id, date, refOrderId from \"part\".Cancel\n"); compareQueryRes0(rCache, "select _key, _val, date, rootOrderId, execShares, price, lastMkt from \"repl\".Exec\n"); @@ -289,10 +298,31 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { /** * @throws Exception If failed. */ + public void testBigSelect() throws Exception { + compareQueryRes0(BSELECT); + } + + /** + * @throws Exception If failed. + */ public void testBigQueryPart1() throws Exception { compareQueryRes0(BQ_COP); } + /** + * @throws Exception If failed. + */ + public void testBigQueryPart2() throws Exception { + compareQueryRes0(BQ_OEP); + } + + /** + * @throws Exception If failed. + */ + public void testBigQueryPart3() throws Exception { + compareQueryRes0(BQ_CC); + } + /** {@inheritDoc} */ @Override protected void initializeH2Schema() throws SQLException { Statement st = conn.createStatement(); @@ -306,6 +336,8 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { " _val other not null," + " orderId int unique," + " rootOrderId int," + + " origOrderId int," + + " archSeq int," + " date Date, " + " alias varchar(255)" + " )"); @@ -317,6 +349,8 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { " id int unique," + " orderId int ," + " rootOrderId int," + + " refOrderId int," + + " archSeq int," + " date Date, " + " alias varchar(255)" + " )"); @@ -361,13 +395,18 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { */ private void insertInDb(CustOrder o) throws SQLException { try(PreparedStatement st = conn.prepareStatement( - "insert into \"part\".CustOrder (_key, _val, orderId, rootOrderId, date, alias) values(?, ?, ?, ?, ?, ?)")) { - st.setObject(1, o.orderId); - st.setObject(2, o); - st.setObject(3, o.orderId); - st.setObject(4, o.rootOrderId); - st.setObject(5, o.date); - st.setObject(6, o.alias); + "insert into \"part\".CustOrder (_key, _val, orderId, rootOrderId, date, alias, archSeq, origOrderId) " + + "values(?, ?, ?, ?, ?, ?, ?, ?)")) { + int i = 0; + + st.setObject(++i, o.orderId); + st.setObject(++i, o); + st.setObject(++i, o.orderId); + st.setObject(++i, o.rootOrderId); + st.setObject(++i, o.date); + st.setObject(++i, o.alias); + st.setObject(++i, o.archSeq); + st.setObject(++i, o.origOrderId); st.executeUpdate(); } @@ -380,8 +419,8 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { */ private void insertInDb(ReplaceOrder o) throws SQLException { try(PreparedStatement st = conn.prepareStatement( - "insert into \"part\".ReplaceOrder (_key, _val, id, orderId, rootOrderId, date, alias) " + - "values(?, ?, ?, ?, ?, ?, ?)")) { + "insert into \"part\".ReplaceOrder (_key, _val, id, orderId, rootOrderId, date, alias, archSeq, refOrderId) " + + "values(?, ?, ?, ?, ?, ?, ?, ?, ?)")) { int i = 0; st.setObject(++i, o.key()); @@ -391,6 +430,8 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { st.setObject(++i, o.rootOrderId); st.setObject(++i, o.date); st.setObject(++i, o.alias); + st.setObject(++i, o.archSeq); + st.setObject(++i, o.refOrderId); st.executeUpdate(); } @@ -469,6 +510,10 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { @QuerySqlField private int rootOrderId; + /** Orig order ID*/ + @QuerySqlField + private int origOrderId; + /** Date */ @QuerySqlField private Date date ; @@ -477,15 +522,20 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { @QuerySqlField private String alias = "CUSTOM"; + /** */ + @QuerySqlField + private int archSeq = 11; // TODO: use it. + /** * @param orderId Order id. * @param rootOrderId Root order id. * @param date Date. * @param alias Alias. */ - CustOrder(int orderId, int rootOrderId, Date date, String alias) { + CustOrder(int orderId, int rootOrderId, Date date, String alias, int origOrderId) { this.orderId = orderId; this.rootOrderId = rootOrderId; + this.origOrderId = origOrderId; this.date = date; this.alias = alias; } @@ -514,6 +564,10 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { @QuerySqlField private int rootOrderId; + /** Ref order ID*/ + @QuerySqlField + private int refOrderId; + /** Date */ @QuerySqlField private Date date ; @@ -522,10 +576,15 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest { @QuerySqlField private String alias = "CUSTOM"; - ReplaceOrder(int id, int orderId, int rootOrderId, String alias, Date date) { + /** */ + @QuerySqlField + private int archSeq = 111; // TODO: use it. + + ReplaceOrder(int id, int orderId, int rootOrderId, String alias, Date date, int refOrderId) { this.id = id; this.orderId = orderId; this.rootOrderId = rootOrderId; + this.refOrderId = refOrderId; this.date = date; this.alias = alias; }