ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [26/39] incubator-ignite git commit: ignite-sql-tests - handle unknown sql type
Date Mon, 16 Mar 2015 05:33:30 GMT
ignite-sql-tests - handle unknown sql type


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

Branch: refs/heads/ignite-45
Commit: 4644fa676d9a2d644f08e4996f855fe5ea1f1f04
Parents: 0e8a442
Author: S.Vladykin <svladykin@gridgain.com>
Authored: Sun Mar 15 22:12:40 2015 +0300
Committer: S.Vladykin <svladykin@gridgain.com>
Committed: Sun Mar 15 22:12:40 2015 +0300

----------------------------------------------------------------------
 .../processors/query/h2/sql/GridSqlElement.java      |  4 ++--
 .../processors/query/h2/sql/GridSqlQueryParser.java  | 15 +++++++++------
 .../query/h2/sql/GridSqlQuerySplitter.java           |  4 +++-
 3 files changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4644fa67/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 e36d6ff..77e6cf0 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
@@ -30,14 +30,14 @@ public abstract class GridSqlElement implements Cloneable, Iterable<GridSqlEleme
     private GridSqlType expressionResultType;
 
     /**
-     * @return Optional expression result type.
+     * @return Optional expression result type (if this is an expression and result type
is known).
      */
     public GridSqlType expressionResultType() {
         return expressionResultType;
     }
 
     /**
-     * @param type Optional expression result type (if this is expression).
+     * @param type Optional expression result type (if this is an expression and result type
is known).
      */
     public void expressionResultType(GridSqlType type) {
         expressionResultType = type;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4644fa67/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
index acb72ac..a8c83d6 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
@@ -24,6 +24,7 @@ import org.h2.expression.*;
 import org.h2.jdbc.*;
 import org.h2.result.*;
 import org.h2.table.*;
+import org.h2.value.*;
 import org.jetbrains.annotations.*;
 
 import java.lang.reflect.*;
@@ -307,11 +308,13 @@ public class GridSqlQueryParser {
         if (res == null) {
             res = parseExpression0(expression);
 
-            Column c = new Column(null, expression.getType(), expression.getPrecision(),
expression.getScale(),
-                expression.getDisplaySize());
+            if (expression.getType() != Value.UNKNOWN) {
+                Column c = new Column(null, expression.getType(), expression.getPrecision(),
expression.getScale(),
+                    expression.getDisplaySize());
 
-            res.expressionResultType(new GridSqlType(c.getType(), c.getScale(), c.getPrecision(),
c.getDisplaySize(),
-                c.getCreateSQL()));
+                res.expressionResultType(new GridSqlType(c.getType(), c.getScale(), c.getPrecision(),
c.getDisplaySize(),
+                    c.getCreateSQL()));
+            }
 
             h2ObjToGridObj.put(expression, res);
         }
@@ -389,13 +392,13 @@ public class GridSqlQueryParser {
 
             assert0(qry instanceof Select, expression);
 
-            return new GridSqlSubquery(parse((Select) qry));
+            return new GridSqlSubquery(parse((Select)qry));
         }
 
         if (expression instanceof ConditionIn) {
             GridSqlOperation res = new GridSqlOperation(IN);
 
-            res.addChild(parseExpression(LEFT_CI.get((ConditionIn) expression)));
+            res.addChild(parseExpression(LEFT_CI.get((ConditionIn)expression)));
 
             List<Expression> vals = VALUE_LIST_CI.get((ConditionIn)expression);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4644fa67/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 ea146ca..af9ffaf 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
@@ -312,7 +312,9 @@ public class GridSqlQuerySplitter {
             if (idx < rdcSelect.length) { // SELECT __C0 AS orginal_alias
                 GridSqlElement rdcEl = column(mapColAlias);
 
-                if (el.expressionResultType().type() == Value.UUID)
+                GridSqlType type = el.expressionResultType();
+
+                if (type != null && type.type() == Value.UUID)
                     rdcEl = function(CAST).setCastType("UUID").addChild(rdcEl);
 
                 if (colNames.add(rdcColAlias))


Mime
View raw message