ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: ignite-437: bigQuery.sql as resource
Date Tue, 07 Apr 2015 14:00:15 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-437-sqltests-p2 c0e1434e0 -> b1d596ae3


ignite-437: bigQuery.sql as resource


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

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

----------------------------------------------------------------------
 .../query/h2/sql/H2CompareBigQueryTest.java     | 29 +++++------
 .../processors/query/h2/sql/bigQuery.sql        | 55 --------------------
 .../indexing/src/test/resources/bigQuery.sql    | 55 ++++++++++++++++++++
 3 files changed, 69 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b1d596ae/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..f2c8831 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             -                              
  |
@@ -70,21 +70,20 @@ public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest
{
     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);
-//        }
+        String res = "";
         
-        BIG_QUERY = "Select 10";
+        try(BufferedReader reader = new BufferedReader(new InputStreamReader(ClassLoader.getSystemResourceAsStream("bigQuery.sql"))))
{
+            for(String line; (line = reader.readLine()) != null; )
+                if (!line.startsWith("--")) // Skip commented lines.
+                    res += line + '\n';
+        }
+        catch (Throwable e) {
+            e.printStackTrace();
+
+            System.exit(1);
+        }
+        
+        BIG_QUERY = res;
     }
         
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b1d596ae/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/bigQuery.sql
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/bigQuery.sql
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/bigQuery.sql
deleted file mode 100644
index 93b62eb..0000000
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/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'

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b1d596ae/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
new file mode 100644
index 0000000..93b62eb
--- /dev/null
+++ b/modules/indexing/src/test/resources/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'


Mime
View raw message