ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [67/67] [abbrv] incubator-ignite git commit: ignite-gg9499 - min, max, sum
Date Fri, 16 Jan 2015 16:45:22 GMT
ignite-gg9499 - min, max, sum


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

Branch: refs/heads/ignite-gg9499
Commit: 20566ffee0da6744e183b881ad871fcac0f0a317
Parents: 7aa4d37
Author: S.Vladykin <svladykin@gridgain.com>
Authored: Fri Jan 16 19:43:45 2015 +0300
Committer: S.Vladykin <svladykin@gridgain.com>
Committed: Fri Jan 16 19:43:45 2015 +0300

----------------------------------------------------------------------
 .../processors/query/h2/sql/GridSqlElement.java |  6 +++---
 .../query/h2/sql/GridSqlQuerySplitter.java      | 21 +++++++++++++++++---
 .../cache/GridCacheCrossCacheQuerySelfTest.java |  6 ++++--
 3 files changed, 25 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/20566ffe/modules/indexing/src/main/java/org/gridgain/grid/kernal/processors/query/h2/sql/GridSqlElement.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/gridgain/grid/kernal/processors/query/h2/sql/GridSqlElement.java
b/modules/indexing/src/main/java/org/gridgain/grid/kernal/processors/query/h2/sql/GridSqlElement.java
index 16c824b..d3463fd 100644
--- a/modules/indexing/src/main/java/org/gridgain/grid/kernal/processors/query/h2/sql/GridSqlElement.java
+++ b/modules/indexing/src/main/java/org/gridgain/grid/kernal/processors/query/h2/sql/GridSqlElement.java
@@ -57,8 +57,8 @@ public abstract class GridSqlElement implements Cloneable {
     }
 
     /** {@inheritDoc} */
-    @SuppressWarnings("CloneCallsConstructors")
-    @Override protected GridSqlElement clone() throws CloneNotSupportedException {
+    @SuppressWarnings({"CloneCallsConstructors", "CloneDoesntDeclareCloneNotSupportedException"})
+    @Override protected GridSqlElement clone() {
         try {
             GridSqlElement res = (GridSqlElement)super.clone();
 
@@ -67,7 +67,7 @@ public abstract class GridSqlElement implements Cloneable {
             return res;
         }
         catch (CloneNotSupportedException e) {
-            throw new RuntimeException(e);
+            throw new IllegalStateException(e);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/20566ffe/modules/indexing/src/main/java/org/gridgain/grid/kernal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/gridgain/grid/kernal/processors/query/h2/sql/GridSqlQuerySplitter.java
b/modules/indexing/src/main/java/org/gridgain/grid/kernal/processors/query/h2/sql/GridSqlQuerySplitter.java
index 6105b2b..1a48540 100644
--- a/modules/indexing/src/main/java/org/gridgain/grid/kernal/processors/query/h2/sql/GridSqlQuerySplitter.java
+++ b/modules/indexing/src/main/java/org/gridgain/grid/kernal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -159,11 +159,26 @@ public class GridSqlQuerySplitter {
 
                     break;
 
-                case COUNT_ALL:
-                case COUNT:
+                case SUM:
                 case MAX:
                 case MIN:
-                case SUM:
+                    GridSqlElement map = aggregate(agg.distinct(), agg.type()).addChild(agg.child());
+
+                    map = alias(columnName(idx), map);
+
+                    mapSelect.set(idx, map);
+
+                    rdc = aggregate(agg.distinct(), agg.type()).addChild(column(((GridSqlAlias)map).alias()));
+
+                    if (alias != null) // Add initial alias if it was set.
+                        rdc = alias(alias.alias(), rdc);
+
+                    rdcSelect[idx] = rdc;
+
+                    break;
+
+                case COUNT_ALL:
+                case COUNT:
                 default:
                     throw new IgniteException("Unsupported aggregate: " + agg.type());
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/20566ffe/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
index 1cf2178..0933bf4 100644
--- a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
@@ -155,10 +155,12 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest
{
         assertFalse(set1.isEmpty());
         assertEquals(set0, set1);
 
-        X.println("___ AVG");
+        X.println("___ AVG MIN MAX SUM");
 
         for (List<?> o : qx.executeTwoStepQuery("partitioned",
-            "select p.name, avg(f.price) from FactPurchase f, \"replicated\".DimProduct p
where p.id = f.productId " +
+            "select p.name, avg(f.price), min(f.price), max(f.price), sum(f.price) " +
+                "from FactPurchase f, \"replicated\".DimProduct p " +
+                "where p.id = f.productId " +
                 "group by f.productId, p.name").get()) {
             X.println("___ -> " + o);
         }


Mime
View raw message