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 2015/04/07 17:02:25 UTC

[1/3] incubator-ignite git commit: ignite-437: fix loading of bigQuery

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-437-sqltests-p2 b1d596ae3 -> 5a9a3f55f


ignite-437: fix loading of bigQuery


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

Branch: refs/heads/ignite-437-sqltests-p2
Commit: e705ac0b1bbaa864f3773dc6a2d42eb1c5b1459b
Parents: c0e1434
Author: Artem Shutak <as...@gridgain.com>
Authored: Tue Apr 7 18:00:27 2015 +0300
Committer: Artem Shutak <as...@gridgain.com>
Committed: Tue Apr 7 18:00:27 2015 +0300

----------------------------------------------------------------------
 .../query/h2/sql/H2CompareBigQueryTest.java     | 41 ++++++++-------
 .../processors/query/h2/sql/bigQuery.sql        | 55 ++++++++++++++++++++
 2 files changed, 76 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e705ac0b/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 03983a8..51d600d 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
@@ -39,7 +39,7 @@ import java.util.concurrent.atomic.*;
  *  |  ------------------            --part.ReplaceOrder--           |                     |
  *  |  --part.CustOrder--            ---------------------           |                     |
  *  |  ------------------            -  id  PK           -           |                     |
- *  |  -  orderId  PK   - <--  <---> -  orderId  PK      -           |                     |
+ *  |  -  orderId  PK   - <--  <---> -  orderId          -           |                     |
  *  -- -  rootOrderId   -   |        -  rootOrderId      - -----------                     |
  *     -  origOrderId   -   |        -  refOrderId       -   // = origOrderId              |
  *     -  date          -   |        -  date             -                                 |
@@ -67,26 +67,27 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest {
     private static final int DATES_CNT = 5;
     
     /** Full the big query. */
-    private static final String BIG_QUERY;
-    
-    static {
-//        String res = "";
-//
-//        String file = "src/test/java/org/apache/ignite/internal/processors/query/h2/sql/Bigquery.sql";
-//
-//        try(BufferedReader reader = new BufferedReader(new FileReader(file))) {
-//            for(String line; (line = reader.readLine()) != null; )
-//                res += line + '\n';
-//        }
-//        catch (IOException e) {
-//            e.printStackTrace();
-//
-//            System.exit(1);
-//        }
+    private String bigQry = getBigQry();
+
+    private String getBigQry() {
+        String res = "";
+
+        Reader isr = new InputStreamReader(getClass().getResourceAsStream("bigQuery.sql"));
         
-        BIG_QUERY = "Select 10";
+        try(BufferedReader reader = new BufferedReader(isr)) {
+            for(String line; (line = reader.readLine()) != null; )
+                if (!line.startsWith("--")) // Skip commented lines.
+                    res += line + '\n';
+        }
+        catch (Throwable e) {
+            e.printStackTrace();
+            
+            fail();
+        }
+
+        return res;
     }
-        
+
     /** {@inheritDoc} */
     @Override protected void setIndexedTypes(CacheConfiguration<?, ?> cc, CacheMode mode) {
         if (mode == CacheMode.PARTITIONED)
@@ -245,7 +246,7 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest {
      * @throws Exception If failed.
      */
     public void testBigQuery() throws Exception {
-        List<List<?>> res = compareQueryRes0(BIG_QUERY);
+        List<List<?>> res = compareQueryRes0(bigQry);
         
         assertTrue(!res.isEmpty()); // Ensure we set good testing data at database.
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e705ac0b/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/query/h2/sql/bigQuery.sql
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/query/h2/sql/bigQuery.sql b/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/query/h2/sql/bigQuery.sql
new file mode 100644
index 0000000..93b62eb
--- /dev/null
+++ b/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/query/h2/sql/bigQuery.sql
@@ -0,0 +1,55 @@
+--
+-- 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.
+--
+
+select *
+from (
+  select rootOrderId as custOrderId, co.date, co.orderId, replace(co.alias,'_ALGO','') as alias, op.parentAlgo
+  from (
+	select  date, orderId, rootOrderId, origOrderId, archSeq, alias 
+	from "part".CustOrder where alias='CUSTOM'
+	
+	union all
+	
+	select  date, orderId, refOrderId as origOrderId, rootOrderId, archSeq, alias 
+	from "part".ReplaceOrder where alias='CUSTOM'
+  ) co, "part".OrderParams op
+  where co.date = op.date and co.orderId = op.orderId and co.archSeq = -- TODO: replace with 'dateToLong(co.date)+archSeq'.
+	(
+	  select max(archSeq) -- TODO: replace with 'dateToLong(co.date)+archSeq'.
+	  from (
+		  select  date, orderId, rootOrderId, origOrderId, archSeq, alias 
+		  from "part".CustOrder where alias='CUSTOM'
+		  
+		  union all
+		  
+		  select  date, orderId, refOrderId as origOrderId, rootOrderId, archSeq, alias 
+		  from "part".ReplaceOrder where alias='CUSTOM'
+	  ) 
+	  where origOrderId = co.origOrderId and date = co.date
+	) and co.alias='CUSTOM'
+) cop 
+inner join (
+  select e.date, e.rootOrderId as eRootOrderId, e.rootOrderId, sum(e.execShares) as execShares, 
+	sum(e.execShares*e.price)/sum(e.execShares) as price,
+	case when min(e.lastMkt) = max(e.lastMkt) then min(e.lastMkt) else min('XOFF') end as execMeet
+  from "repl".Exec e
+  group by e.date, e.rootOrderId
+) oep on (cop.date = oep.date and cop.custOrderId = oep.eRootOrderId)
+left outer join (
+  select top 1 refOrderId, date from "part".Cancel
+) cc on (cc.refOrderId = cop.orderId and cc.date = cop.date)
+where cop.alias='CUSTOM'


[2/3] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-437-sqltests-p2' into ignite-437-sqltests-p2

Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-437-sqltests-p2' into ignite-437-sqltests-p2

Conflicts:
	modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryTest.java


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

Branch: refs/heads/ignite-437-sqltests-p2
Commit: 7b5109e79d6d21c3faacc27ca28b8aefb002c83c
Parents: e705ac0 b1d596a
Author: Artem Shutak <as...@gridgain.com>
Authored: Tue Apr 7 18:01:22 2015 +0300
Committer: Artem Shutak <as...@gridgain.com>
Committed: Tue Apr 7 18:01:22 2015 +0300

----------------------------------------------------------------------
 .../processors/query/h2/sql/bigQuery.sql        | 55 --------------------
 .../indexing/src/test/resources/bigQuery.sql    | 55 ++++++++++++++++++++
 2 files changed, 55 insertions(+), 55 deletions(-)
----------------------------------------------------------------------



[3/3] incubator-ignite git commit: ignite-437: merge

Posted by sb...@apache.org.
ignite-437: merge


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

Branch: refs/heads/ignite-437-sqltests-p2
Commit: 5a9a3f55f3bb75500d314e75d5eb90e1cff263da
Parents: 7b5109e
Author: Artem Shutak <as...@gridgain.com>
Authored: Tue Apr 7 18:02:21 2015 +0300
Committer: Artem Shutak <as...@gridgain.com>
Committed: Tue Apr 7 18:02:21 2015 +0300

----------------------------------------------------------------------
 .../indexing/src/test/resources/bigQuery.sql    | 55 --------------------
 1 file changed, 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a9a3f55/modules/indexing/src/test/resources/bigQuery.sql
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/resources/bigQuery.sql b/modules/indexing/src/test/resources/bigQuery.sql
deleted file mode 100644
index 93b62eb..0000000
--- a/modules/indexing/src/test/resources/bigQuery.sql
+++ /dev/null
@@ -1,55 +0,0 @@
---
--- 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.
---
-
-select *
-from (
-  select rootOrderId as custOrderId, co.date, co.orderId, replace(co.alias,'_ALGO','') as alias, op.parentAlgo
-  from (
-	select  date, orderId, rootOrderId, origOrderId, archSeq, alias 
-	from "part".CustOrder where alias='CUSTOM'
-	
-	union all
-	
-	select  date, orderId, refOrderId as origOrderId, rootOrderId, archSeq, alias 
-	from "part".ReplaceOrder where alias='CUSTOM'
-  ) co, "part".OrderParams op
-  where co.date = op.date and co.orderId = op.orderId and co.archSeq = -- TODO: replace with 'dateToLong(co.date)+archSeq'.
-	(
-	  select max(archSeq) -- TODO: replace with 'dateToLong(co.date)+archSeq'.
-	  from (
-		  select  date, orderId, rootOrderId, origOrderId, archSeq, alias 
-		  from "part".CustOrder where alias='CUSTOM'
-		  
-		  union all
-		  
-		  select  date, orderId, refOrderId as origOrderId, rootOrderId, archSeq, alias 
-		  from "part".ReplaceOrder where alias='CUSTOM'
-	  ) 
-	  where origOrderId = co.origOrderId and date = co.date
-	) and co.alias='CUSTOM'
-) cop 
-inner join (
-  select e.date, e.rootOrderId as eRootOrderId, e.rootOrderId, sum(e.execShares) as execShares, 
-	sum(e.execShares*e.price)/sum(e.execShares) as price,
-	case when min(e.lastMkt) = max(e.lastMkt) then min(e.lastMkt) else min('XOFF') end as execMeet
-  from "repl".Exec e
-  group by e.date, e.rootOrderId
-) oep on (cop.date = oep.date and cop.custOrderId = oep.eRootOrderId)
-left outer join (
-  select top 1 refOrderId, date from "part".Cancel
-) cc on (cc.refOrderId = cop.orderId and cc.date = cop.date)
-where cop.alias='CUSTOM'