ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [05/18] incubator-ignite git commit: ignite-1015 - lists
Date Thu, 23 Jul 2015 07:40:33 GMT
ignite-1015 - lists


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

Branch: refs/heads/ignite-752
Commit: 12af70bf57bdf77acf376a5baec9cbde6083565a
Parents: 0bb26bb
Author: S.Vladykin <svladykin@gridgain.com>
Authored: Wed Jul 22 07:27:25 2015 +0300
Committer: S.Vladykin <svladykin@gridgain.com>
Committed: Wed Jul 22 07:27:25 2015 +0300

----------------------------------------------------------------------
 .../processors/query/h2/sql/GridSqlAlias.java       | 16 +++++++++++++++-
 .../processors/query/h2/sql/GridSqlColumn.java      |  4 ++++
 .../processors/query/h2/sql/GridSqlConst.java       |  4 ++++
 .../processors/query/h2/sql/GridSqlElement.java     | 16 ++++++++++++++--
 .../processors/query/h2/sql/GridSqlFunction.java    |  2 ++
 .../processors/query/h2/sql/GridSqlJoin.java        |  4 ++++
 .../processors/query/h2/sql/GridSqlOperation.java   |  7 +++++++
 .../query/h2/sql/GridSqlOperationType.java          |  2 ++
 .../processors/query/h2/sql/GridSqlParameter.java   |  4 ++++
 .../processors/query/h2/sql/GridSqlPlaceholder.java |  4 ++++
 .../query/h2/sql/GridSqlQuerySplitter.java          |  2 +-
 .../processors/query/h2/sql/GridSqlSubquery.java    |  4 ++++
 .../processors/query/h2/sql/GridSqlTable.java       |  4 ++++
 13 files changed, 69 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12af70bf/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlAlias.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlAlias.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlAlias.java
index 464a135..5e827a0 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlAlias.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlAlias.java
@@ -19,6 +19,8 @@ package org.apache.ignite.internal.processors.query.h2.sql;
 
 import org.h2.command.*;
 
+import java.util.*;
+
 /**
  * Alias for column or table.
  */
@@ -43,12 +45,24 @@ public class GridSqlAlias extends GridSqlElement {
      * @param useAs Use 'AS' keyword.
      */
     public GridSqlAlias(String alias, GridSqlElement expr, boolean useAs) {
-        addChild(expr);
+        super(list(expr));
 
         this.useAs = useAs;
         this.alias = alias;
     }
 
+    /**
+     * @param el Element.
+     * @return List.
+     */
+    private static List<GridSqlElement> list(GridSqlElement el) {
+        List<GridSqlElement> res = new ArrayList<>(1);
+
+        res.add(el);
+
+        return res;
+    }
+
     /** {@inheritDoc} */
     @Override public String getSQL() {
         return child().getSQL() + (useAs ? " AS " : " ") + Parser.quoteIdentifier(alias);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12af70bf/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlColumn.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlColumn.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlColumn.java
index 2353b48..d3d7d1d 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlColumn.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlColumn.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.processors.query.h2.sql;
 
+import java.util.*;
+
 /**
  * Column.
  */
@@ -36,6 +38,8 @@ public class GridSqlColumn extends GridSqlElement implements GridSqlValue
{
      * @param sqlText Text.
      */
     public GridSqlColumn(GridSqlElement from, String name, String sqlText) {
+        super(Collections.<GridSqlElement>emptyList());
+
         assert sqlText != null;
 
         expressionInFrom = from;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12af70bf/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlConst.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlConst.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlConst.java
index f416243..124bc94 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlConst.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlConst.java
@@ -19,6 +19,8 @@ package org.apache.ignite.internal.processors.query.h2.sql;
 
 import org.h2.value.*;
 
+import java.util.*;
+
 /**
  * Constant value.
  */
@@ -30,6 +32,8 @@ public class GridSqlConst extends GridSqlElement implements GridSqlValue
{
      * @param val Value.
      */
     public GridSqlConst(Value val) {
+        super(Collections.<GridSqlElement>emptyList());
+
         this.val = val;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12af70bf/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java
index 9a6b410..7ad8d5a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java
@@ -24,12 +24,21 @@ import java.util.*;
  */
 public abstract class GridSqlElement implements Iterable<GridSqlElement> {
     /** */
-    protected List<GridSqlElement> children = new ArrayList<>();
+    protected List<GridSqlElement> children;
 
     /** */
     private GridSqlType expressionResultType;
 
     /**
+     * @param children Initial child list.
+     */
+    protected GridSqlElement(List<GridSqlElement> children) {
+        assert children != null;
+
+        this.children = children;
+    }
+
+    /**
      * @return Optional expression result type (if this is an expression and result type
is known).
      */
     public GridSqlType expressionResultType() {
@@ -67,7 +76,7 @@ public abstract class GridSqlElement implements Iterable<GridSqlElement>
{
      * @return First child.
      */
     public GridSqlElement child() {
-        return children.get(0);
+        return child(0);
     }
 
     /**
@@ -83,6 +92,9 @@ public abstract class GridSqlElement implements Iterable<GridSqlElement>
{
      * @param child New child.
      */
     public void child(int idx, GridSqlElement child) {
+        if (child == null)
+            throw new NullPointerException();
+
         children.set(idx, child);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12af70bf/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunction.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunction.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunction.java
index 9479538..c41bbb7 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunction.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlFunction.java
@@ -66,6 +66,8 @@ public class GridSqlFunction extends GridSqlElement {
      * @param name Name.
      */
     private GridSqlFunction(String schema, GridSqlFunctionType type, String name) {
+        super(new ArrayList<GridSqlElement>());
+
         if (name == null)
             throw new NullPointerException();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12af70bf/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlJoin.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlJoin.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlJoin.java
index 69ebdbf..ddd9ba7 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlJoin.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlJoin.java
@@ -20,6 +20,8 @@ package org.apache.ignite.internal.processors.query.h2.sql;
 import org.h2.util.*;
 import org.jetbrains.annotations.*;
 
+import java.util.*;
+
 /**
  * Join of two tables or subqueries.
  */
@@ -34,6 +36,8 @@ public class GridSqlJoin extends GridSqlElement {
      * @param on Join condition.
      */
     public GridSqlJoin(GridSqlElement leftTbl, GridSqlElement rightTbl, boolean leftOuter,
@Nullable GridSqlElement on) {
+        super(new ArrayList<GridSqlElement>(on == null ? 2 : 3));
+
         addChild(leftTbl);
         addChild(rightTbl);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12af70bf/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlOperation.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlOperation.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlOperation.java
index 6100618..395754b 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlOperation.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlOperation.java
@@ -17,6 +17,10 @@
 
 package org.apache.ignite.internal.processors.query.h2.sql;
 
+import java.util.*;
+
+import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlOperationType.*;
+
 /**
  * Unary or binary operation.
  */
@@ -28,6 +32,9 @@ public class GridSqlOperation extends GridSqlElement {
      * @param opType Operation type.
      */
     public GridSqlOperation(GridSqlOperationType opType) {
+        super(opType == IN ? new ArrayList<GridSqlElement>() :
+            new ArrayList<GridSqlElement>(opType.childrenCount()));
+
         this.opType = opType;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12af70bf/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlOperationType.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlOperationType.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlOperationType.java
index a071e73..cfe7576 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlOperationType.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlOperationType.java
@@ -70,6 +70,8 @@ public enum GridSqlOperationType {
      * @param sqlGenerator sqlGenerator.
      */
     GridSqlOperationType(int childrenCnt, SqlGenerator sqlGenerator) {
+        assert childrenCnt > 0 || sqlGenerator instanceof ConditionInSqlGenerator : childrenCnt;
+
         this.childrenCnt = childrenCnt;
         this.sqlGenerator = sqlGenerator;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12af70bf/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlParameter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlParameter.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlParameter.java
index 1332c97..fc71659 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlParameter.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlParameter.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.processors.query.h2.sql;
 
+import java.util.*;
+
 /**
  * Query parameter.
  */
@@ -28,6 +30,8 @@ public class GridSqlParameter extends GridSqlElement implements GridSqlValue
{
      * @param idx Index.
      */
     public GridSqlParameter(int idx) {
+        super(Collections.<GridSqlElement>emptyList());
+
         this.idx = idx;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12af70bf/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlPlaceholder.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlPlaceholder.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlPlaceholder.java
index 02fa7d7..6b94f20 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlPlaceholder.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlPlaceholder.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.processors.query.h2.sql;
 
+import java.util.*;
+
 /**
  * Placeholder.
  */
@@ -31,6 +33,8 @@ public class GridSqlPlaceholder extends GridSqlElement {
      * @param sql SQL.
      */
     public GridSqlPlaceholder(String sql) {
+        super(Collections.<GridSqlElement>emptyList());
+
         this.sql = sql;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12af70bf/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
index b1dc0dc..6c1886b 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -285,7 +285,7 @@ public class GridSqlQuerySplitter {
         if (el instanceof GridSqlAlias)
             el = el.child();
 
-        if (el instanceof GridSqlOperation || el instanceof GridSqlFunction || el instanceof
GridSqlAggregateFunction) {
+        if (el instanceof GridSqlOperation || el instanceof GridSqlFunction) {
             for (GridSqlElement child : el)
                 collectAllSpacesInSubqueries(child, spaces);
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12af70bf/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSubquery.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSubquery.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSubquery.java
index 4b60969..04314c7 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSubquery.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSubquery.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.processors.query.h2.sql;
 
+import java.util.*;
+
 /**
  * Subquery.
  */
@@ -28,6 +30,8 @@ public class GridSqlSubquery extends GridSqlElement {
      * @param select Select.
      */
     public GridSqlSubquery(GridSqlQuery select) {
+        super(Collections.<GridSqlElement>emptyList());
+
         this.select = select;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12af70bf/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlTable.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlTable.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlTable.java
index b51845a..b76f962 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlTable.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlTable.java
@@ -20,6 +20,8 @@ package org.apache.ignite.internal.processors.query.h2.sql;
 import org.h2.command.*;
 import org.jetbrains.annotations.*;
 
+import java.util.*;
+
 /**
  * Table with optional schema.
  */
@@ -35,6 +37,8 @@ public class GridSqlTable extends GridSqlElement {
      * @param tblName Table name.
      */
     public GridSqlTable(@Nullable String schema, String tblName) {
+        super(Collections.<GridSqlElement>emptyList());
+
         this.schema = schema;
         this.tblName = tblName;
     }


Mime
View raw message