phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajeshb...@apache.org
Subject phoenix git commit: PHOENIX-3647 Fix parsing issues in CREATE VIEW DDL in Phoenix-Calcite(Rajeshbabu)
Date Fri, 03 Feb 2017 07:43:57 GMT
Repository: phoenix
Updated Branches:
  refs/heads/calcite 76fae2c86 -> 8728510fa


PHOENIX-3647 Fix parsing issues in CREATE VIEW DDL in Phoenix-Calcite(Rajeshbabu)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8728510f
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8728510f
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8728510f

Branch: refs/heads/calcite
Commit: 8728510fa7b02138742b5688e6f56faec32bf139
Parents: 76fae2c
Author: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Authored: Fri Feb 3 13:26:28 2017 +0530
Committer: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Committed: Fri Feb 3 13:26:28 2017 +0530

----------------------------------------------------------------------
 .../src/main/codegen/includes/parserImpls.ftl    | 19 +++++++++++++++++--
 .../phoenix/calcite/parse/SqlCreateTable.java    |  6 ++++--
 2 files changed, 21 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8728510f/phoenix-core/src/main/codegen/includes/parserImpls.ftl
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/codegen/includes/parserImpls.ftl b/phoenix-core/src/main/codegen/includes/parserImpls.ftl
index afebe85..aef9010 100644
--- a/phoenix-core/src/main/codegen/includes/parserImpls.ftl
+++ b/phoenix-core/src/main/codegen/includes/parserImpls.ftl
@@ -71,6 +71,8 @@ SqlNode SqlCreateView() :
     SqlNodeList columnDefs;
     SqlIdentifier baseTableName;
     SqlNode where;
+    SqlIdentifier pkConstraint = null;
+    SqlNodeList pkConstraintColumnDefs = SqlNodeList.EMPTY;
     SqlNodeList tableOptions;
 }
 {
@@ -86,11 +88,23 @@ SqlNode SqlCreateView() :
     (
         <LPAREN>
         columnDefs = ColumnDefList()
-        <RPAREN>
+        (
+            (
+                <COMMA>
+            )?
+            <CONSTRAINT> pkConstraint = SimpleIdentifier() <PRIMARY> <KEY>
+            <LPAREN> pkConstraintColumnDefs = PkConstraintColumnDefList() <RPAREN>
+            |
+            {
+                pkConstraint = null;
+                pkConstraintColumnDefs = SqlNodeList.EMPTY;
+            }
+        )
         |
         {
             columnDefs = SqlNodeList.EMPTY;
         }
+	<RPAREN>
     )
     (
         <AS> <SELECT> <STAR> <FROM> baseTableName = DualIdentifier()
@@ -112,7 +126,8 @@ SqlNode SqlCreateView() :
         return new SqlCreateTable(pos.plus(getPos()), tableName,
             SqlLiteral.createBoolean(false, SqlParserPos.ZERO),        
             SqlLiteral.createBoolean(ifNotExists, SqlParserPos.ZERO),
-            columnDefs, baseTableName, where, tableOptions);
+            columnDefs, pkConstraint, pkConstraintColumnDefs, baseTableName,
+            where, tableOptions);
     }
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/8728510f/phoenix-core/src/main/java/org/apache/phoenix/calcite/parse/SqlCreateTable.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/parse/SqlCreateTable.java
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/parse/SqlCreateTable.java
index 6b72d0a..a2baecc 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/parse/SqlCreateTable.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/parse/SqlCreateTable.java
@@ -80,6 +80,8 @@ public class SqlCreateTable extends SqlCall {
             SqlLiteral immutable,
             SqlLiteral ifNotExists,
             SqlNodeList columnDefs,
+            SqlIdentifier pkConstraint,
+            SqlNodeList pkConstraintColumnDefs,
             SqlIdentifier baseTableName,
             SqlNode whereNode,
             SqlNodeList tableOptions) {
@@ -89,8 +91,8 @@ public class SqlCreateTable extends SqlCall {
         this.immutable = immutable;
         this.ifNotExists = ifNotExists;
         this.columnDefs = columnDefs;
-        this.pkConstraint = null;
-        this.pkConstraintColumnDefs = SqlNodeList.EMPTY;
+        this.pkConstraint = pkConstraint;
+        this.pkConstraintColumnDefs = pkConstraintColumnDefs;
         this.baseTableName = baseTableName;
         this.whereNode = whereNode;
         this.tableOptions = tableOptions;


Mime
View raw message