ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [28/50] [abbrv] incubator-ignite git commit: ignite-sprint-3 - sql
Date Fri, 10 Apr 2015 10:18:27 GMT
ignite-sprint-3 - sql


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

Branch: refs/heads/ignite-676
Commit: 968a3ad35b98a6989f0f64003166f977564af713
Parents: 27b6b78
Author: S.Vladykin <svladykin@gridgain.com>
Authored: Thu Apr 9 18:05:57 2015 +0300
Committer: S.Vladykin <svladykin@gridgain.com>
Committed: Thu Apr 9 18:05:57 2015 +0300

----------------------------------------------------------------------
 .../query/h2/sql/GridSqlQueryParser.java        | 24 ++++++++++++++------
 1 file changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/968a3ad3/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 b174d71..3817c1a 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
@@ -199,9 +199,7 @@ public class GridSqlQueryParser {
             else if (tbl instanceof TableView) {
                 Query qry = VIEW_QUERY.get((TableView)tbl);
 
-                assert0(qry instanceof Select, qry);
-
-                res = new GridSqlSubquery(parse((Select)qry));
+                res = new GridSqlSubquery(parse(qry));
             }
             else if (tbl instanceof FunctionTable)
                 res = parseExpression(FUNC_EXPR.get((FunctionTable)tbl));
@@ -518,8 +516,18 @@ public class GridSqlQueryParser {
 
             GridSqlFunction res = new GridSqlFunction(null, f.getName());
 
-            for (Expression arg : f.getArgs())
-                res.addChild(parseExpression(arg));
+            if (f.getArgs() != null) {
+                for (Expression arg : f.getArgs()) {
+                    if (arg == null) {
+                        if (f.getFunctionType() != Function.CASE)
+                            throw new IllegalStateException("Function type with null arg:
" + f.getFunctionType());
+
+                        continue;
+                    }
+
+                    res.addChild(parseExpression(arg));
+                }
+            }
 
             if (f.getFunctionType() == Function.CAST || f.getFunctionType() == Function.CONVERT)
                 res.setCastType(new Column(null, f.getType(), f.getPrecision(), f.getScale(),
f.getDisplaySize())
@@ -535,8 +543,10 @@ public class GridSqlQueryParser {
 
             GridSqlFunction res = new GridSqlFunction(alias.getSchema().getName(), f.getName());
 
-            for (Expression arg : f.getArgs())
-                res.addChild(parseExpression(arg));
+            if (f.getArgs() != null) {
+                for (Expression arg : f.getArgs())
+                    res.addChild(parseExpression(arg));
+            }
 
             return res;
         }


Mime
View raw message