hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcama...@apache.org
Subject [03/21] hive git commit: HIVE-16575: Support for 'UNIQUE' and 'NOT NULL' constraints (Jesus Camacho Rodriguez, reviewed by Ashutosh Chauhan)
Date Thu, 25 May 2017 10:28:58 GMT
http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
index 218fa8a..22998c4 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
@@ -105,12 +105,15 @@ TOK_IMPORT;
 TOK_REPLICATION;
 TOK_METADATA;
 TOK_NULL;
+TOK_NOT_NULL;
+TOK_UNIQUE;
 TOK_PRIMARY_KEY;
 TOK_FOREIGN_KEY;
 TOK_VALIDATE;
 TOK_NOVALIDATE;
 TOK_RELY;
 TOK_NORELY;
+TOK_CONSTRAINT_NAME;
 TOK_TINYINT;
 TOK_SMALLINT;
 TOK_INT;
@@ -549,6 +552,7 @@ import org.apache.hadoop.hive.conf.HiveConf;
     xlateMap.put("KW_UPDATE", "UPDATE");
     xlateMap.put("KW_VALUES", "VALUES");
     xlateMap.put("KW_PURGE", "PURGE");
+    xlateMap.put("KW_UNIQUE", "UNIQUE");
     xlateMap.put("KW_PRIMARY", "PRIMARY");
     xlateMap.put("KW_FOREIGN", "FOREIGN");
     xlateMap.put("KW_KEY", "KEY");
@@ -1004,7 +1008,7 @@ createTableStatement
          tableFileFormat?
          tableLocation?
          tablePropertiesPrefixed?
-       | (LPAREN columnNameTypeOrPKOrFKList RPAREN)?
+       | (LPAREN columnNameTypeOrConstraintList RPAREN)?
          tableComment?
          tablePartition?
          tableBuckets?
@@ -1017,7 +1021,7 @@ createTableStatement
       )
     -> ^(TOK_CREATETABLE $name $temp? $ext? ifNotExists?
          ^(TOK_LIKETABLE $likeName?)
-         columnNameTypeOrPKOrFKList?
+         columnNameTypeOrConstraintList?
          tableComment?
          tablePartition?
          tableBuckets?
@@ -1232,9 +1236,9 @@ alterStatementSuffixAddCol
 alterStatementSuffixAddConstraint
 @init { pushMsg("add constraint statement", state); }
 @after { popMsg(state); }
-   :  KW_ADD (fk=foreignKeyWithName | primaryKeyWithName)
-   -> {fk != null}? ^(TOK_ALTERTABLE_ADDCONSTRAINT foreignKeyWithName)
-   ->               ^(TOK_ALTERTABLE_ADDCONSTRAINT primaryKeyWithName)
+   :  KW_ADD (fk=alterForeignKeyWithName | alterConstraintWithName)
+   -> {fk != null}? ^(TOK_ALTERTABLE_ADDCONSTRAINT alterForeignKeyWithName)
+   ->               ^(TOK_ALTERTABLE_ADDCONSTRAINT alterConstraintWithName)
    ;
 
 alterStatementSuffixDropConstraint
@@ -1247,8 +1251,8 @@ alterStatementSuffixDropConstraint
 alterStatementSuffixRenameCol
 @init { pushMsg("rename column name", state); }
 @after { popMsg(state); }
-    : KW_CHANGE KW_COLUMN? oldName=identifier newName=identifier colType (KW_COMMENT comment=StringLiteral)? alterStatementChangeColPosition? restrictOrCascade?
-    ->^(TOK_ALTERTABLE_RENAMECOL $oldName $newName colType $comment? alterStatementChangeColPosition? restrictOrCascade?)
+    : KW_CHANGE KW_COLUMN? oldName=identifier newName=identifier colType alterColumnConstraint[$newName.tree]? (KW_COMMENT comment=StringLiteral)? alterStatementChangeColPosition? restrictOrCascade?
+    ->^(TOK_ALTERTABLE_RENAMECOL $oldName $newName colType $comment? alterColumnConstraint? alterStatementChangeColPosition? restrictOrCascade?)
     ;
 
 alterStatementSuffixUpdateStatsCol
@@ -2106,10 +2110,10 @@ columnNameTypeList
 @after { popMsg(state); }
     : columnNameType (COMMA columnNameType)* -> ^(TOK_TABCOLLIST columnNameType+)
     ;
-columnNameTypeOrPKOrFKList
+columnNameTypeOrConstraintList
 @init { pushMsg("column name type list with PK and FK", state); }
 @after { popMsg(state); }
-    : columnNameTypeOrPKOrFK (COMMA columnNameTypeOrPKOrFK)* -> ^(TOK_TABCOLLIST columnNameTypeOrPKOrFK+)
+    : columnNameTypeOrConstraint (COMMA columnNameTypeOrConstraint)* -> ^(TOK_TABCOLLIST columnNameTypeOrConstraint+)
     ;
 
 columnNameColonTypeList
@@ -2150,6 +2154,12 @@ columnParenthesesList
     : LPAREN! columnNameList RPAREN!
     ;
 
+enableValidateSpecification
+@init { pushMsg("enable specification", state); }
+@after { popMsg(state); }
+    : enableSpecification validateSpecification?
+    ;
+
 enableSpecification
 @init { pushMsg("enable specification", state); }
 @after { popMsg(state); }
@@ -2171,32 +2181,36 @@ relySpecification
     |  (KW_NORELY)? -> ^(TOK_NORELY)
     ;
 
-primaryKeyWithoutName
-@init { pushMsg("primary key without key name", state); }
+createConstraint
+@init { pushMsg("pk or uk or nn constraint", state); }
 @after { popMsg(state); }
-    : KW_PRIMARY KW_KEY columnParenthesesList enableSpec=enableSpecification validateSpec=validateSpecification relySpec=relySpecification
-    -> ^(TOK_PRIMARY_KEY columnParenthesesList $relySpec $enableSpec $validateSpec)
+    : (KW_CONSTRAINT constraintName=identifier)? tableConstraintType pkCols=columnParenthesesList constraintOptsCreate?
+    -> {$constraintName.tree != null}?
+            ^(tableConstraintType $pkCols ^(TOK_CONSTRAINT_NAME $constraintName) constraintOptsCreate?)
+    -> ^(tableConstraintType $pkCols constraintOptsCreate?)
     ;
 
-primaryKeyWithName
-@init { pushMsg("primary key with key name", state); }
+alterConstraintWithName
+@init { pushMsg("pk or uk or nn constraint with name", state); }
 @after { popMsg(state); }
-    : KW_CONSTRAINT idfr=identifier KW_PRIMARY KW_KEY pkCols=columnParenthesesList enableSpec=enableSpecification validateSpec=validateSpecification relySpec=relySpecification
-    -> ^(TOK_PRIMARY_KEY $pkCols $idfr $relySpec $enableSpec $validateSpec)
+    : KW_CONSTRAINT constraintName=identifier tableConstraintType pkCols=columnParenthesesList constraintOptsAlter?
+    -> ^(tableConstraintType $pkCols ^(TOK_CONSTRAINT_NAME $constraintName) constraintOptsAlter?)
     ;
 
-foreignKeyWithName
-@init { pushMsg("foreign key with key name", state); }
+createForeignKey
+@init { pushMsg("foreign key", state); }
 @after { popMsg(state); }
-    : KW_CONSTRAINT idfr=identifier KW_FOREIGN KW_KEY fkCols=columnParenthesesList  KW_REFERENCES tabName=tableName parCols=columnParenthesesList enableSpec=enableSpecification validateSpec=validateSpecification relySpec=relySpecification
-    -> ^(TOK_FOREIGN_KEY $idfr $fkCols $tabName $parCols $relySpec $enableSpec $validateSpec)
+    : (KW_CONSTRAINT constraintName=identifier)? KW_FOREIGN KW_KEY fkCols=columnParenthesesList  KW_REFERENCES tabName=tableName parCols=columnParenthesesList constraintOptsCreate?
+    -> {$constraintName.tree != null}?
+            ^(TOK_FOREIGN_KEY ^(TOK_CONSTRAINT_NAME $constraintName) $fkCols $tabName $parCols constraintOptsCreate?)
+    -> ^(TOK_FOREIGN_KEY $fkCols $tabName $parCols constraintOptsCreate?)
     ;
 
-foreignKeyWithoutName
-@init { pushMsg("foreign key without key name", state); }
+alterForeignKeyWithName
+@init { pushMsg("foreign key with key name", state); }
 @after { popMsg(state); }
-    : KW_FOREIGN KW_KEY fkCols=columnParenthesesList  KW_REFERENCES tabName=tableName parCols=columnParenthesesList enableSpec=enableSpecification validateSpec=validateSpecification relySpec=relySpecification
-    -> ^(TOK_FOREIGN_KEY $fkCols  $tabName $parCols $relySpec $enableSpec $validateSpec)
+    : KW_CONSTRAINT constraintName=identifier KW_FOREIGN KW_KEY fkCols=columnParenthesesList  KW_REFERENCES tabName=tableName parCols=columnParenthesesList constraintOptsAlter?
+    -> ^(TOK_FOREIGN_KEY ^(TOK_CONSTRAINT_NAME $constraintName) $fkCols $tabName $parCols constraintOptsAlter?)
     ;
 
 skewedValueElement
@@ -2310,14 +2324,94 @@ columnNameType
     ->                     ^(TOK_TABCOL $colName colType $comment)
     ;
 
-columnNameTypeOrPKOrFK
-@init { pushMsg("column name or primary key or foreign key", state); }
+columnNameTypeOrConstraint
+@init { pushMsg("column name or constraint", state); }
+@after { popMsg(state); }
+    : ( tableConstraint )
+    | ( columnNameTypeConstraint )
+    ;
+
+tableConstraint
+@init { pushMsg("table constraint", state); }
+@after { popMsg(state); }
+    : ( createForeignKey )
+    | ( createConstraint )
+    ;
+
+columnNameTypeConstraint
+@init { pushMsg("column specification", state); }
+@after { popMsg(state); }
+    : colName=identifier colType columnConstraint[$colName.tree]? (KW_COMMENT comment=StringLiteral)?
+    -> {containExcludedCharForCreateTableColumnName($colName.text)}? {throwColumnNameException()}
+    -> ^(TOK_TABCOL $colName colType $comment? columnConstraint?)
+    ;
+
+columnConstraint[CommonTree fkColName]
+@init { pushMsg("column constraint", state); }
+@after { popMsg(state); }
+    : ( foreignKeyConstraint[$fkColName] )
+    | ( colConstraint )
+    ;
+
+foreignKeyConstraint[CommonTree fkColName]
+@init { pushMsg("column constraint", state); }
 @after { popMsg(state); }
-    : ( foreignKeyWithName )
-    | ( primaryKeyWithName )
-    | ( primaryKeyWithoutName )
-    | ( foreignKeyWithoutName )
-    | ( columnNameType )
+    : (KW_CONSTRAINT constraintName=identifier)? KW_REFERENCES tabName=tableName LPAREN colName=columnName RPAREN constraintOptsCreate?
+    -> {$constraintName.tree != null}?
+            ^(TOK_FOREIGN_KEY ^(TOK_CONSTRAINT_NAME $constraintName) ^(TOK_TABCOLNAME {$fkColName}) $tabName ^(TOK_TABCOLNAME $colName) constraintOptsCreate?)
+    -> ^(TOK_FOREIGN_KEY ^(TOK_TABCOLNAME {$fkColName}) $tabName ^(TOK_TABCOLNAME $colName) constraintOptsCreate?)
+    ;
+
+colConstraint
+@init { pushMsg("column constraint", state); }
+@after { popMsg(state); }
+    : (KW_CONSTRAINT constraintName=identifier)? columnConstraintType constraintOptsCreate?
+    -> {$constraintName.tree != null}?
+            ^(columnConstraintType ^(TOK_CONSTRAINT_NAME $constraintName) constraintOptsCreate?)
+    -> ^(columnConstraintType constraintOptsCreate?)
+    ;
+
+alterColumnConstraint[CommonTree fkColName]
+@init { pushMsg("alter column constraint", state); }
+@after { popMsg(state); }
+    : ( alterForeignKeyConstraint[$fkColName] )
+    | ( alterColConstraint )
+    ;
+
+alterForeignKeyConstraint[CommonTree fkColName]
+@init { pushMsg("alter column constraint", state); }
+@after { popMsg(state); }
+    : (KW_CONSTRAINT constraintName=identifier)? KW_REFERENCES tabName=tableName LPAREN colName=columnName RPAREN constraintOptsAlter?
+    -> {$constraintName.tree != null}?
+            ^(TOK_FOREIGN_KEY ^(TOK_CONSTRAINT_NAME $constraintName) ^(TOK_TABCOLNAME {$fkColName}) $tabName ^(TOK_TABCOLNAME $colName) constraintOptsAlter?)
+    -> ^(TOK_FOREIGN_KEY ^(TOK_TABCOLNAME {$fkColName}) $tabName ^(TOK_TABCOLNAME $colName) constraintOptsAlter?)
+    ;
+
+alterColConstraint
+@init { pushMsg("alter column constraint", state); }
+@after { popMsg(state); }
+    : (KW_CONSTRAINT constraintName=identifier)? columnConstraintType constraintOptsAlter?
+    -> {$constraintName.tree != null}?
+            ^(columnConstraintType ^(TOK_CONSTRAINT_NAME $constraintName) constraintOptsAlter?)
+    -> ^(columnConstraintType constraintOptsAlter?)
+    ;
+
+columnConstraintType
+    : KW_NOT KW_NULL       ->    TOK_NOT_NULL
+    | tableConstraintType
+    ;
+
+tableConstraintType
+    : KW_PRIMARY KW_KEY    ->    TOK_PRIMARY_KEY
+    | KW_UNIQUE            ->    TOK_UNIQUE
+    ;
+
+constraintOptsCreate
+    : enableValidateSpecification relySpecification
+    ;
+
+constraintOptsAlter
+    : enableValidateSpecification relySpecification
     ;
 
 columnNameColonType

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
index 43a61ce..f2b0bd0 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
@@ -73,7 +73,9 @@ import org.apache.hadoop.hive.metastore.api.FieldSchema;
 import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.hadoop.hive.metastore.api.Order;
 import org.apache.hadoop.hive.metastore.api.SQLForeignKey;
+import org.apache.hadoop.hive.metastore.api.SQLNotNullConstraint;
 import org.apache.hadoop.hive.metastore.api.SQLPrimaryKey;
+import org.apache.hadoop.hive.metastore.api.SQLUniqueConstraint;
 import org.apache.hadoop.hive.ql.CompilationOpContext;
 import org.apache.hadoop.hive.ql.Context;
 import org.apache.hadoop.hive.ql.ErrorMsg;
@@ -11961,6 +11963,8 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
     List<String> bucketCols = new ArrayList<String>();
     List<SQLPrimaryKey> primaryKeys = new ArrayList<SQLPrimaryKey>();
     List<SQLForeignKey> foreignKeys = new ArrayList<SQLForeignKey>();
+    List<SQLUniqueConstraint> uniqueConstraints = new ArrayList<>();
+    List<SQLNotNullConstraint> notNullConstraints = new ArrayList<>();
     List<Order> sortCols = new ArrayList<Order>();
     int numBuckets = -1;
     String comment = null;
@@ -12053,7 +12057,8 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
         selectStmt = child;
         break;
       case HiveParser.TOK_TABCOLLIST:
-        cols = getColumns(child, true, primaryKeys, foreignKeys);
+        cols = getColumns(child, true, primaryKeys, foreignKeys,
+            uniqueConstraints, notNullConstraints);
         break;
       case HiveParser.TOK_TABLECOMMENT:
         comment = unescapeSQLString(child.getChild(0).getText());
@@ -12167,7 +12172,7 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
           comment,
           storageFormat.getInputFormat(), storageFormat.getOutputFormat(), location, storageFormat.getSerde(),
           storageFormat.getStorageHandler(), storageFormat.getSerdeProps(), tblProps, ifNotExists, skewedColNames,
-          skewedValues, primaryKeys, foreignKeys);
+          skewedValues, primaryKeys, foreignKeys, uniqueConstraints, notNullConstraints);
       crtTblDesc.setStoredAsSubDirectories(storedAsDirs);
       crtTblDesc.setNullFormat(rowFormatParams.nullFormat);
 
@@ -12264,7 +12269,8 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
           rowFormatParams.lineDelim, comment, storageFormat.getInputFormat(),
           storageFormat.getOutputFormat(), location, storageFormat.getSerde(),
           storageFormat.getStorageHandler(), storageFormat.getSerdeProps(), tblProps, ifNotExists,
-	  skewedColNames, skewedValues, true, primaryKeys, foreignKeys);
+	        skewedColNames, skewedValues, true, primaryKeys, foreignKeys,
+	        uniqueConstraints, notNullConstraints);
       tableDesc.setMaterialization(isMaterialization);
       tableDesc.setStoredAsSubDirectories(storedAsDirs);
       tableDesc.setNullFormat(rowFormatParams.nullFormat);

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/java/org/apache/hadoop/hive/ql/plan/AlterTableDesc.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/AlterTableDesc.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/AlterTableDesc.java
index d5a6679..6cfde18 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/AlterTableDesc.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/AlterTableDesc.java
@@ -22,7 +22,9 @@ import org.apache.hadoop.hive.metastore.api.EnvironmentContext;
 import org.apache.hadoop.hive.metastore.api.FieldSchema;
 import org.apache.hadoop.hive.metastore.api.Order;
 import org.apache.hadoop.hive.metastore.api.SQLForeignKey;
+import org.apache.hadoop.hive.metastore.api.SQLNotNullConstraint;
 import org.apache.hadoop.hive.metastore.api.SQLPrimaryKey;
+import org.apache.hadoop.hive.metastore.api.SQLUniqueConstraint;
 import org.apache.hadoop.hive.ql.exec.Utilities;
 import org.apache.hadoop.hive.ql.metadata.Table;
 import org.apache.hadoop.hive.ql.parse.ParseUtils;
@@ -127,6 +129,8 @@ public class AlterTableDesc extends DDLDesc implements Serializable {
   String dropConstraintName;
   List<SQLPrimaryKey> primaryKeyCols;
   List<SQLForeignKey> foreignKeyCols;
+  List<SQLUniqueConstraint> uniqueConstraintCols;
+  List<SQLNotNullConstraint> notNullConstraintCols;
 
   public AlterTableDesc() {
   }
@@ -157,6 +161,28 @@ public class AlterTableDesc extends DDLDesc implements Serializable {
     this.isCascade = isCascade;
   }
 
+  public AlterTableDesc(String tblName, HashMap<String, String> partSpec,
+      String oldColName, String newColName, String newType, String newComment,
+      boolean first, String afterCol, boolean isCascade, List<SQLPrimaryKey> primaryKeyCols,
+      List<SQLForeignKey> foreignKeyCols, List<SQLUniqueConstraint> uniqueConstraintCols,
+      List<SQLNotNullConstraint> notNullConstraintCols) {
+    super();
+    oldName = tblName;
+    this.partSpec = partSpec;
+    this.oldColName = oldColName;
+    this.newColName = newColName;
+    newColType = newType;
+    newColComment = newComment;
+    this.first = first;
+    this.afterCol = afterCol;
+    op = AlterTableTypes.RENAMECOLUMN;
+    this.isCascade = isCascade;
+    this.primaryKeyCols = primaryKeyCols;
+    this.foreignKeyCols = foreignKeyCols;
+    this.uniqueConstraintCols = uniqueConstraintCols;
+    this.notNullConstraintCols = notNullConstraintCols;
+  }
+
   /**
    * @param oldName
    *          old name of the table
@@ -280,10 +306,12 @@ public class AlterTableDesc extends DDLDesc implements Serializable {
     op = AlterTableTypes.DROPCONSTRAINT;
   }
 
-  public AlterTableDesc(String tableName, List<SQLPrimaryKey> primaryKeyCols, List<SQLForeignKey> foreignKeyCols) {
+  public AlterTableDesc(String tableName, List<SQLPrimaryKey> primaryKeyCols,
+          List<SQLForeignKey> foreignKeyCols, List<SQLUniqueConstraint> uniqueConstraintCols) {
     this.oldName = tableName;
     this.primaryKeyCols = primaryKeyCols;
     this.foreignKeyCols = foreignKeyCols;
+    this.uniqueConstraintCols = uniqueConstraintCols;
     op = AlterTableTypes.ADDCONSTRAINT;
   }
 
@@ -462,6 +490,20 @@ public class AlterTableDesc extends DDLDesc implements Serializable {
   }
 
   /**
+   * @return the unique constraint cols
+   */
+  public List<SQLUniqueConstraint> getUniqueConstraintCols() {
+    return uniqueConstraintCols;
+  }
+
+  /**
+   * @return the not null constraint cols
+   */
+  public List<SQLNotNullConstraint> getNotNullConstraintCols() {
+    return notNullConstraintCols;
+  }
+
+  /**
    * @return the drop constraint name of the table
    */
   @Explain(displayName = "drop constraint name", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/java/org/apache/hadoop/hive/ql/plan/CreateTableDesc.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/CreateTableDesc.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/CreateTableDesc.java
index d971c73..7b46fcd 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/CreateTableDesc.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/CreateTableDesc.java
@@ -32,7 +32,9 @@ import org.apache.hadoop.hive.metastore.TableType;
 import org.apache.hadoop.hive.metastore.api.FieldSchema;
 import org.apache.hadoop.hive.metastore.api.Order;
 import org.apache.hadoop.hive.metastore.api.SQLForeignKey;
+import org.apache.hadoop.hive.metastore.api.SQLNotNullConstraint;
 import org.apache.hadoop.hive.metastore.api.SQLPrimaryKey;
+import org.apache.hadoop.hive.metastore.api.SQLUniqueConstraint;
 import org.apache.hadoop.hive.ql.ErrorMsg;
 import org.apache.hadoop.hive.ql.exec.DDLTask;
 import org.apache.hadoop.hive.ql.exec.Utilities;
@@ -96,6 +98,8 @@ public class CreateTableDesc extends DDLDesc implements Serializable {
   private boolean isCTAS = false;
   List<SQLPrimaryKey> primaryKeys;
   List<SQLForeignKey> foreignKeys;
+  List<SQLUniqueConstraint> uniqueConstraints;
+  List<SQLNotNullConstraint> notNullConstraints;
 
   public CreateTableDesc() {
   }
@@ -110,13 +114,15 @@ public class CreateTableDesc extends DDLDesc implements Serializable {
       Map<String, String> serdeProps,
       Map<String, String> tblProps,
       boolean ifNotExists, List<String> skewedColNames, List<List<String>> skewedColValues,
-      List<SQLPrimaryKey> primaryKeys, List<SQLForeignKey> foreignKeys) {
+      List<SQLPrimaryKey> primaryKeys, List<SQLForeignKey> foreignKeys,
+      List<SQLUniqueConstraint> uniqueConstraints, List<SQLNotNullConstraint> notNullConstraints) {
 
     this(tableName, isExternal, isTemporary, cols, partCols,
         bucketCols, sortCols, numBuckets, fieldDelim, fieldEscape,
         collItemDelim, mapKeyDelim, lineDelim, comment, inputFormat,
         outputFormat, location, serName, storageHandler, serdeProps,
-        tblProps, ifNotExists, skewedColNames, skewedColValues, primaryKeys, foreignKeys);
+        tblProps, ifNotExists, skewedColNames, skewedColValues,
+        primaryKeys, foreignKeys, uniqueConstraints, notNullConstraints);
 
     this.databaseName = databaseName;
   }
@@ -131,12 +137,14 @@ public class CreateTableDesc extends DDLDesc implements Serializable {
                          Map<String, String> serdeProps,
                          Map<String, String> tblProps,
                          boolean ifNotExists, List<String> skewedColNames, List<List<String>> skewedColValues,
-                         boolean isCTAS, List<SQLPrimaryKey> primaryKeys, List<SQLForeignKey> foreignKeys) {
+                         boolean isCTAS, List<SQLPrimaryKey> primaryKeys, List<SQLForeignKey> foreignKeys,
+                         List<SQLUniqueConstraint> uniqueConstraints, List<SQLNotNullConstraint> notNullConstraints) {
     this(databaseName, tableName, isExternal, isTemporary, cols, partCols,
             bucketCols, sortCols, numBuckets, fieldDelim, fieldEscape,
             collItemDelim, mapKeyDelim, lineDelim, comment, inputFormat,
             outputFormat, location, serName, storageHandler, serdeProps,
-            tblProps, ifNotExists, skewedColNames, skewedColValues, primaryKeys, foreignKeys);
+            tblProps, ifNotExists, skewedColNames, skewedColValues,
+            primaryKeys, foreignKeys, uniqueConstraints, notNullConstraints);
     this.isCTAS = isCTAS;
 
   }
@@ -152,7 +160,8 @@ public class CreateTableDesc extends DDLDesc implements Serializable {
       Map<String, String> serdeProps,
       Map<String, String> tblProps,
       boolean ifNotExists, List<String> skewedColNames, List<List<String>> skewedColValues,
-      List<SQLPrimaryKey> primaryKeys, List<SQLForeignKey> foreignKeys) {
+      List<SQLPrimaryKey> primaryKeys, List<SQLForeignKey> foreignKeys,
+      List<SQLUniqueConstraint> uniqueConstraints, List<SQLNotNullConstraint> notNullConstraints) {
     this.tableName = tableName;
     this.isExternal = isExternal;
     this.isTemporary = isTemporary;
@@ -177,16 +186,10 @@ public class CreateTableDesc extends DDLDesc implements Serializable {
     this.ifNotExists = ifNotExists;
     this.skewedColNames = copyList(skewedColNames);
     this.skewedColValues = copyList(skewedColValues);
-    if (primaryKeys == null) {
-      this.primaryKeys = new ArrayList<SQLPrimaryKey>();
-    } else {
-      this.primaryKeys = new ArrayList<SQLPrimaryKey>(primaryKeys);
-    }
-    if (foreignKeys == null) {
-      this.foreignKeys = new ArrayList<SQLForeignKey>();
-    } else {
-      this.foreignKeys = new ArrayList<SQLForeignKey>(foreignKeys);
-    }
+    this.primaryKeys = copyList(primaryKeys);
+    this.foreignKeys = copyList(foreignKeys);
+    this.uniqueConstraints = copyList(uniqueConstraints);
+    this.notNullConstraints = copyList(notNullConstraints);
   }
 
   private static <T> List<T> copyList(List<T> copy) {
@@ -257,6 +260,14 @@ public class CreateTableDesc extends DDLDesc implements Serializable {
     this.foreignKeys = foreignKeys;
   }
 
+  public List<SQLUniqueConstraint> getUniqueConstraints() {
+    return uniqueConstraints;
+  }
+
+  public List<SQLNotNullConstraint> getNotNullConstraints() {
+    return notNullConstraints;
+  }
+
   @Explain(displayName = "bucket columns")
   public List<String> getBucketCols() {
     return bucketCols;

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/java/org/apache/hadoop/hive/ql/plan/ImportTableDesc.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/ImportTableDesc.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/ImportTableDesc.java
index f43627d..bb02c26 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/ImportTableDesc.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/ImportTableDesc.java
@@ -74,7 +74,11 @@ public class ImportTableDesc {
                 (null == table.getSd().getSkewedInfo()) ? null : table.getSd().getSkewedInfo()
                         .getSkewedColNames(),
                 (null == table.getSd().getSkewedInfo()) ? null : table.getSd().getSkewedInfo()
-                        .getSkewedColValues(), null, null);
+                        .getSkewedColValues(),
+                null,
+                null,
+                null,
+                null);
         this.createTblDesc.setStoredAsSubDirectories(table.getSd().isStoredAsSubDirectories());
         break;
       case VIEW:

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/org/apache/hadoop/hive/ql/parse/TestHiveDecimalParse.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestHiveDecimalParse.java b/ql/src/test/org/apache/hadoop/hive/ql/parse/TestHiveDecimalParse.java
index 7073374..9f155e1 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestHiveDecimalParse.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/parse/TestHiveDecimalParse.java
@@ -104,7 +104,7 @@ public class TestHiveDecimalParse {
     int rc = driver.compile(query);
     Assert.assertTrue("Got " + rc + ", expected not zero", rc != 0);
     Assert.assertTrue(driver.getErrorMsg(),
-      driver.getErrorMsg().contains("missing ) at ',' near ',' in column name or primary key or foreign key"));
+      driver.getErrorMsg().contains("missing ) at ',' near ',' in column name or constraint"));
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java b/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java
index 8be8583..1a89eb1 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/parse/TestSQL11ReservedKeyWordsNegative.java
@@ -1072,6 +1072,19 @@ public class TestSQL11ReservedKeyWordsNegative {
 		}
 	}
 
+  @Test
+  public void testSQL11ReservedKeyWords_UNIQUE() {
+    try {
+      parse("CREATE TABLE UNIQUE (col STRING)");
+      Assert.assertFalse("Expected ParseException", true);
+    } catch (ParseException ex) {
+      Assert.assertEquals(
+          "Failure didn't match.",
+          "line 1:13 cannot recognize input near 'UNIQUE' '(' 'col' in table name",
+          ex.getMessage());
+    }
+  }
+
 	@Test
 	public void testSQL11ReservedKeyWords_UPDATE() {
 		try {

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/queries/clientnegative/alter_table_constraint_duplicate_pk.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/alter_table_constraint_duplicate_pk.q b/ql/src/test/queries/clientnegative/alter_table_constraint_duplicate_pk.q
index f77eb29..82de06d 100644
--- a/ql/src/test/queries/clientnegative/alter_table_constraint_duplicate_pk.q
+++ b/ql/src/test/queries/clientnegative/alter_table_constraint_duplicate_pk.q
@@ -1,2 +1,2 @@
-CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate);
+CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable);
 alter table table1 add constraint pk4 primary key (b) disable novalidate rely;

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_col1.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_col1.q b/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_col1.q
index e12808d..88be76a 100644
--- a/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_col1.q
+++ b/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_col1.q
@@ -1,3 +1,3 @@
-CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate);
-CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable novalidate rely);
+CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable);
+CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable rely);
 alter table table2 add constraint fk1 foreign key (c) references table1(a) disable novalidate;

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_col2.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_col2.q b/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_col2.q
index 97703de..cfc0757 100644
--- a/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_col2.q
+++ b/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_col2.q
@@ -1,3 +1,3 @@
-CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate);
-CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable novalidate rely);
+CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable);
+CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable rely);
 alter table table2 add constraint fk1 foreign key (b) references table1(c) disable novalidate;

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_tbl1.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_tbl1.q b/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_tbl1.q
index dcd7839..0cc7c87 100644
--- a/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_tbl1.q
+++ b/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_tbl1.q
@@ -1,3 +1,3 @@
-CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate);
-CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable novalidate rely);
+CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable);
+CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable rely);
 alter table table3 add constraint fk1 foreign key (c) references table1(a) disable novalidate;

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_tbl2.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_tbl2.q b/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_tbl2.q
index c18247b..f019eb5 100644
--- a/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_tbl2.q
+++ b/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_fk_tbl2.q
@@ -1,3 +1,3 @@
-CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate);
-CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable novalidate rely);
+CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable);
+CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable rely);
 alter table table2 add constraint fk1 foreign key (b) references table3(a) disable novalidate;

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_pk_tbl.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_pk_tbl.q b/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_pk_tbl.q
index b6850fa..ced99f5 100644
--- a/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_pk_tbl.q
+++ b/ql/src/test/queries/clientnegative/alter_table_constraint_invalid_pk_tbl.q
@@ -1,3 +1,3 @@
-CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate);
+CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable);
 CREATE TABLE table2 (a STRING, b STRING);
 alter table table3 add constraint pk3 primary key (a) disable novalidate rely;

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/queries/clientnegative/create_with_constraints_duplicate_name.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/create_with_constraints_duplicate_name.q b/ql/src/test/queries/clientnegative/create_with_constraints_duplicate_name.q
index b6b30c5..a0bc7f6 100644
--- a/ql/src/test/queries/clientnegative/create_with_constraints_duplicate_name.q
+++ b/ql/src/test/queries/clientnegative/create_with_constraints_duplicate_name.q
@@ -1,2 +1,2 @@
-create table t1(x int, constraint pk1 primary key (x) disable novalidate);
-create table t2(x int, constraint pk1 primary key (x) disable novalidate);
+create table t1(x int, constraint pk1 primary key (x) disable);
+create table t2(x int, constraint pk1 primary key (x) disable);

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/queries/clientnegative/create_with_constraints_enable.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/create_with_constraints_enable.q b/ql/src/test/queries/clientnegative/create_with_constraints_enable.q
index 4ce3cbc..59ebb1e 100644
--- a/ql/src/test/queries/clientnegative/create_with_constraints_enable.q
+++ b/ql/src/test/queries/clientnegative/create_with_constraints_enable.q
@@ -1 +1 @@
-CREATE TABLE table1 (a STRING, b STRING, primary key (a) enable novalidate);
+CREATE TABLE table1 (a STRING, b STRING, primary key (a) enable);

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/queries/clientnegative/create_with_fk_constraint.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/create_with_fk_constraint.q b/ql/src/test/queries/clientnegative/create_with_fk_constraint.q
new file mode 100644
index 0000000..ea77d84
--- /dev/null
+++ b/ql/src/test/queries/clientnegative/create_with_fk_constraint.q
@@ -0,0 +1,2 @@
+CREATE TABLE table2 (a STRING PRIMARY KEY DISABLE, b STRING);
+CREATE TABLE table1 (a STRING, b STRING, CONSTRAINT fk1 FOREIGN KEY (x) REFERENCES table2(a) DISABLE);

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/queries/clientnegative/create_with_multi_pk_constraint.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/create_with_multi_pk_constraint.q b/ql/src/test/queries/clientnegative/create_with_multi_pk_constraint.q
new file mode 100644
index 0000000..46306fc
--- /dev/null
+++ b/ql/src/test/queries/clientnegative/create_with_multi_pk_constraint.q
@@ -0,0 +1 @@
+CREATE TABLE table1 (a STRING PRIMARY KEY DISABLE, b STRING PRIMARY KEY DISABLE);

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/queries/clientnegative/drop_invalid_constraint1.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/drop_invalid_constraint1.q b/ql/src/test/queries/clientnegative/drop_invalid_constraint1.q
index 2055f9e..128eb2c 100644
--- a/ql/src/test/queries/clientnegative/drop_invalid_constraint1.q
+++ b/ql/src/test/queries/clientnegative/drop_invalid_constraint1.q
@@ -1,3 +1,3 @@
-CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate);
+CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable);
 ALTER TABLE table1 DROP CONSTRAINT pk1;
 ALTER TABLE table1 DROP CONSTRAINT pk1;

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/queries/clientnegative/drop_invalid_constraint2.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/drop_invalid_constraint2.q b/ql/src/test/queries/clientnegative/drop_invalid_constraint2.q
index d253617..871bd3e 100644
--- a/ql/src/test/queries/clientnegative/drop_invalid_constraint2.q
+++ b/ql/src/test/queries/clientnegative/drop_invalid_constraint2.q
@@ -1,2 +1,2 @@
-CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate);
+CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable);
 ALTER TABLE table1 DROP CONSTRAINT pk1;

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/queries/clientnegative/drop_invalid_constraint3.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/drop_invalid_constraint3.q b/ql/src/test/queries/clientnegative/drop_invalid_constraint3.q
index 04eb1fb..ca1f599 100644
--- a/ql/src/test/queries/clientnegative/drop_invalid_constraint3.q
+++ b/ql/src/test/queries/clientnegative/drop_invalid_constraint3.q
@@ -1,2 +1,2 @@
-CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate);
+CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable);
 ALTER TABLE table2 DROP CONSTRAINT pk2;

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/queries/clientnegative/drop_invalid_constraint4.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/drop_invalid_constraint4.q b/ql/src/test/queries/clientnegative/drop_invalid_constraint4.q
index 3cf2d2a..25026b0 100644
--- a/ql/src/test/queries/clientnegative/drop_invalid_constraint4.q
+++ b/ql/src/test/queries/clientnegative/drop_invalid_constraint4.q
@@ -1,3 +1,3 @@
-CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate);
-CREATE TABLE table2 (a STRING, b STRING, constraint pk2 primary key (a) disable novalidate);
+CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable);
+CREATE TABLE table2 (a STRING, b STRING, constraint pk2 primary key (a) disable);
 ALTER TABLE table1 DROP CONSTRAINT pk2;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/queries/clientpositive/create_with_constraints.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/create_with_constraints.q b/ql/src/test/queries/clientpositive/create_with_constraints.q
index 7dc15c1..9700b5c 100644
--- a/ql/src/test/queries/clientpositive/create_with_constraints.q
+++ b/ql/src/test/queries/clientpositive/create_with_constraints.q
@@ -1,17 +1,24 @@
-CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate);
-CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate);
-CREATE TABLE table3 (x string, PRIMARY KEY (x) disable novalidate, CONSTRAINT fk1 FOREIGN KEY (x) REFERENCES table2(a)  DISABLE NOVALIDATE); 
-CREATE TABLE table4 (x string, y string, PRIMARY KEY (x) disable novalidate, CONSTRAINT fk2 FOREIGN KEY (x) REFERENCES table2(a)  DISABLE NOVALIDATE, 
-CONSTRAINT fk3 FOREIGN KEY (y) REFERENCES table2(a)  DISABLE NOVALIDATE);
-CREATE TABLE table5 (x string, PRIMARY KEY (x) disable novalidate, FOREIGN KEY (x) REFERENCES table2(a)  DISABLE NOVALIDATE);
-CREATE TABLE table6 (x string, y string, PRIMARY KEY (x) disable novalidate, FOREIGN KEY (x) REFERENCES table2(a)  DISABLE NOVALIDATE,
-CONSTRAINT fk4 FOREIGN KEY (y) REFERENCES table1(a)  DISABLE NOVALIDATE);
-CREATE TABLE table7 (a STRING, b STRING, primary key (a) disable novalidate rely);
-CREATE TABLE table8 (a STRING, b STRING, constraint pk8 primary key (a) disable novalidate norely);
-CREATE TABLE table9 (a STRING, b STRING, primary key (a, b) disable novalidate rely);
-CREATE TABLE table10 (a STRING, b STRING, constraint pk10 primary key (a) disable novalidate norely, foreign key (a, b) references table9(a, b) disable novalidate);
-CREATE TABLE table11 (a STRING, b STRING, c STRING, constraint pk11 primary key (a) disable novalidate rely, constraint fk11_1 foreign key (a, b) references table9(a, b) disable novalidate,
-constraint fk11_2 foreign key (c) references table4(x) disable novalidate);
+CREATE TABLE table1 (a STRING, b STRING, PRIMARY KEY (a) DISABLE);
+CREATE TABLE table2 (a STRING, b STRING, CONSTRAINT pk1 PRIMARY KEY (a) DISABLE);
+CREATE TABLE table3 (x string NOT NULL DISABLE, PRIMARY KEY (x) DISABLE, CONSTRAINT fk1 FOREIGN KEY (x) REFERENCES table2(a) DISABLE); 
+CREATE TABLE table4 (x string CONSTRAINT nn4_1 NOT NULL DISABLE, y string CONSTRAINT nn4_2 NOT NULL DISABLE, UNIQUE (x) DISABLE, CONSTRAINT fk2 FOREIGN KEY (x) REFERENCES table2(a) DISABLE, 
+CONSTRAINT fk3 FOREIGN KEY (y) REFERENCES table2(a) DISABLE);
+CREATE TABLE table5 (x string, PRIMARY KEY (x) DISABLE, FOREIGN KEY (x) REFERENCES table2(a) DISABLE);
+CREATE TABLE table6 (x string, y string, PRIMARY KEY (x) DISABLE, FOREIGN KEY (x) REFERENCES table2(a) DISABLE,
+CONSTRAINT fk4 FOREIGN KEY (y) REFERENCES table1(a) DISABLE);
+CREATE TABLE table7 (a STRING, b STRING, PRIMARY KEY (a) DISABLE RELY);
+CREATE TABLE table8 (a STRING, b STRING, CONSTRAINT pk8 PRIMARY KEY (a) DISABLE NORELY);
+CREATE TABLE table9 (a STRING, b STRING, PRIMARY KEY (a, b) DISABLE RELY);
+CREATE TABLE table10 (a STRING, b STRING, CONSTRAINT pk10 PRIMARY KEY (a) DISABLE NORELY, FOREIGN KEY (a, b) REFERENCES table9(a, b) DISABLE);
+CREATE TABLE table11 (a STRING, b STRING, c STRING, CONSTRAINT pk11 PRIMARY KEY (a) DISABLE RELY, CONSTRAINT fk11_1 FOREIGN KEY (a, b) REFERENCES table9(a, b) DISABLE,
+CONSTRAINT fk11_2 FOREIGN KEY (c) REFERENCES table4(x) DISABLE);
+CREATE TABLE table12 (a STRING CONSTRAINT nn12_1 NOT NULL DISABLE NORELY, b STRING);
+CREATE TABLE table13 (a STRING NOT NULL DISABLE RELY, b STRING);
+CREATE TABLE table14 (a STRING CONSTRAINT nn14_1 NOT NULL DISABLE RELY, b STRING);
+CREATE TABLE table15 (a STRING REFERENCES table4(x) DISABLE, b STRING);
+CREATE TABLE table16 (a STRING CONSTRAINT nn16_1 REFERENCES table4(x) DISABLE RELY, b STRING);
+CREATE TABLE table17 (a STRING CONSTRAINT uk17_1 UNIQUE DISABLE RELY, b STRING);
+CREATE TABLE table18 (a STRING, b STRING, CONSTRAINT uk18_1 UNIQUE (b) DISABLE RELY);
 
 DESCRIBE EXTENDED table1;
 DESCRIBE EXTENDED table2;
@@ -24,6 +31,13 @@ DESCRIBE EXTENDED table8;
 DESCRIBE EXTENDED table9;
 DESCRIBE EXTENDED table10;
 DESCRIBE EXTENDED table11;
+DESCRIBE EXTENDED table12;
+DESCRIBE EXTENDED table13;
+DESCRIBE EXTENDED table14;
+DESCRIBE EXTENDED table15;
+DESCRIBE EXTENDED table16;
+DESCRIBE EXTENDED table17;
+DESCRIBE EXTENDED table18;
 
 DESCRIBE FORMATTED table1;
 DESCRIBE FORMATTED table2;
@@ -36,30 +50,60 @@ DESCRIBE FORMATTED table8;
 DESCRIBE FORMATTED table9;
 DESCRIBE FORMATTED table10;
 DESCRIBE FORMATTED table11;
+DESCRIBE FORMATTED table12;
+DESCRIBE FORMATTED table13;
+DESCRIBE FORMATTED table14;
+DESCRIBE FORMATTED table15;
+DESCRIBE FORMATTED table16;
+DESCRIBE FORMATTED table17;
+DESCRIBE FORMATTED table18;
 
 ALTER TABLE table2 DROP CONSTRAINT pk1;
 ALTER TABLE table3 DROP CONSTRAINT fk1;
+ALTER TABLE table4 DROP CONSTRAINT nn4_1;
 ALTER TABLE table6 DROP CONSTRAINT fk4;
+ALTER TABLE table16 DROP CONSTRAINT nn16_1;
+ALTER TABLE table18 DROP CONSTRAINT uk18_1;
 
 DESCRIBE EXTENDED table2;
 DESCRIBE EXTENDED table3;
+DESCRIBE EXTENDED table4;
 DESCRIBE EXTENDED table6;
+DESCRIBE EXTENDED table16;
+DESCRIBE EXTENDED table18;
 
 DESCRIBE FORMATTED table2;
 DESCRIBE FORMATTED table3;
+DESCRIBE FORMATTED table4;
 DESCRIBE FORMATTED table6;
+DESCRIBE FORMATTED table16;
+DESCRIBE FORMATTED table18;
 
-ALTER TABLE table2 ADD CONSTRAINT pkt2 primary key (a) disable novalidate;
-ALTER TABLE table3 ADD CONSTRAINT fk1 FOREIGN KEY (x) REFERENCES table2(a)  DISABLE NOVALIDATE RELY;
-ALTER TABLE table6 ADD CONSTRAINT fk4 FOREIGN KEY (y) REFERENCES table1(a)  DISABLE NOVALIDATE;
+ALTER TABLE table2 ADD CONSTRAINT pkt2 PRIMARY KEY (a) DISABLE NOVALIDATE;
+ALTER TABLE table3 ADD CONSTRAINT fk1 FOREIGN KEY (x) REFERENCES table2(a) DISABLE NOVALIDATE RELY;
+ALTER TABLE table6 ADD CONSTRAINT fk4 FOREIGN KEY (y) REFERENCES table1(a) DISABLE NOVALIDATE;
+ALTER TABLE table16 CHANGE a a STRING REFERENCES table4(x) DISABLE NOVALIDATE;
+ALTER TABLE table18 ADD CONSTRAINT uk18_2 UNIQUE (a, b) DISABLE NOVALIDATE;
 
 DESCRIBE FORMATTED table2;
 DESCRIBE FORMATTED table3;
 DESCRIBE FORMATTED table6;
+DESCRIBE FORMATTED table16;
+DESCRIBE FORMATTED table18;
+
+ALTER TABLE table12 CHANGE COLUMN b b STRING CONSTRAINT nn12_2 NOT NULL DISABLE NOVALIDATE;
+ALTER TABLE table13 CHANGE b b STRING NOT NULL DISABLE NOVALIDATE;
+
+DESCRIBE FORMATTED table12;
+DESCRIBE FORMATTED table13;
+
+ALTER TABLE table12 DROP CONSTRAINT nn12_2;
+
+DESCRIBE FORMATTED table12;
 
 CREATE DATABASE DbConstraint;
 USE DbConstraint;
-CREATE TABLE Table2 (a STRING, b STRING, constraint Pk1 primary key (a) disable novalidate);
+CREATE TABLE Table2 (a STRING, b STRING NOT NULL DISABLE, CONSTRAINT Pk1 PRIMARY KEY (a) DISABLE);
 USE default;
 
 DESCRIBE EXTENDED DbConstraint.Table2;
@@ -70,7 +114,7 @@ ALTER TABLE DbConstraint.Table2 DROP CONSTRAINT Pk1;
 DESCRIBE EXTENDED DbConstraint.Table2;
 DESCRIBE FORMATTED DbConstraint.Table2;
 
-ALTER TABLE DbConstraint.Table2 ADD CONSTRAINT Pk1 primary key (a) disable novalidate;
+ALTER TABLE DbConstraint.Table2 ADD CONSTRAINT Pk1 PRIMARY KEY (a) DISABLE NOVALIDATE;
 DESCRIBE FORMATTED DbConstraint.Table2;
-ALTER TABLE DbConstraint.Table2  ADD CONSTRAINT fkx FOREIGN KEY (b) REFERENCES table1(a)  DISABLE NOVALIDATE;
+ALTER TABLE DbConstraint.Table2 ADD CONSTRAINT fkx FOREIGN KEY (b) REFERENCES table1(a) DISABLE NOVALIDATE;
 DESCRIBE FORMATTED DbConstraint.Table2;

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/results/clientnegative/alter_table_constraint_duplicate_pk.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/alter_table_constraint_duplicate_pk.q.out b/ql/src/test/results/clientnegative/alter_table_constraint_duplicate_pk.q.out
index d1bb637..30ad841 100644
--- a/ql/src/test/results/clientnegative/alter_table_constraint_duplicate_pk.q.out
+++ b/ql/src/test/results/clientnegative/alter_table_constraint_duplicate_pk.q.out
@@ -1,8 +1,8 @@
-PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate)
+PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@table1
-POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate)
+POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table1

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_col1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_col1.q.out b/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_col1.q.out
index 2cd85c4..1617609 100644
--- a/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_col1.q.out
+++ b/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_col1.q.out
@@ -1,16 +1,16 @@
-PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate)
+PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@table1
-POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate)
+POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table1
-PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable novalidate rely)
+PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable rely)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@table2
-POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable novalidate rely)
+POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable rely)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table2

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_col2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_col2.q.out b/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_col2.q.out
index 86c38c1..47166ac 100644
--- a/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_col2.q.out
+++ b/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_col2.q.out
@@ -1,16 +1,16 @@
-PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate)
+PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@table1
-POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate)
+POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table1
-PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable novalidate rely)
+PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable rely)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@table2
-POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable novalidate rely)
+POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable rely)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table2

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_tbl1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_tbl1.q.out b/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_tbl1.q.out
index 16edd44..49bc928 100644
--- a/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_tbl1.q.out
+++ b/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_tbl1.q.out
@@ -1,16 +1,16 @@
-PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate)
+PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@table1
-POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate)
+POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table1
-PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable novalidate rely)
+PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable rely)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@table2
-POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable novalidate rely)
+POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable rely)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table2

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_tbl2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_tbl2.q.out b/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_tbl2.q.out
index 31dfcd1..f5ac4ac 100644
--- a/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_tbl2.q.out
+++ b/ql/src/test/results/clientnegative/alter_table_constraint_invalid_fk_tbl2.q.out
@@ -1,16 +1,16 @@
-PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate)
+PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@table1
-POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate)
+POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table1
-PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable novalidate rely)
+PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable rely)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@table2
-POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable novalidate rely)
+POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, primary key (a) disable rely)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table2

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/results/clientnegative/alter_table_constraint_invalid_pk_tbl.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/alter_table_constraint_invalid_pk_tbl.q.out b/ql/src/test/results/clientnegative/alter_table_constraint_invalid_pk_tbl.q.out
index 0207d8c..792134c 100644
--- a/ql/src/test/results/clientnegative/alter_table_constraint_invalid_pk_tbl.q.out
+++ b/ql/src/test/results/clientnegative/alter_table_constraint_invalid_pk_tbl.q.out
@@ -1,8 +1,8 @@
-PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate)
+PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@table1
-POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable novalidate)
+POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, primary key (a) disable)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table1

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/results/clientnegative/create_with_constraints_duplicate_name.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/create_with_constraints_duplicate_name.q.out b/ql/src/test/results/clientnegative/create_with_constraints_duplicate_name.q.out
index 989ff38..e4747d4 100644
--- a/ql/src/test/results/clientnegative/create_with_constraints_duplicate_name.q.out
+++ b/ql/src/test/results/clientnegative/create_with_constraints_duplicate_name.q.out
@@ -1,12 +1,12 @@
-PREHOOK: query: create table t1(x int, constraint pk1 primary key (x) disable novalidate)
+PREHOOK: query: create table t1(x int, constraint pk1 primary key (x) disable)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@t1
-POSTHOOK: query: create table t1(x int, constraint pk1 primary key (x) disable novalidate)
+POSTHOOK: query: create table t1(x int, constraint pk1 primary key (x) disable)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@t1
-PREHOOK: query: create table t2(x int, constraint pk1 primary key (x) disable novalidate)
+PREHOOK: query: create table t2(x int, constraint pk1 primary key (x) disable)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@t2

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/results/clientnegative/create_with_constraints_enable.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/create_with_constraints_enable.q.out b/ql/src/test/results/clientnegative/create_with_constraints_enable.q.out
index f5dcf85..65d3bfe 100644
--- a/ql/src/test/results/clientnegative/create_with_constraints_enable.q.out
+++ b/ql/src/test/results/clientnegative/create_with_constraints_enable.q.out
@@ -1 +1 @@
-FAILED: SemanticException [Error 10326]: Invalid Primary Key syntax  ENABLE feature not supported yet
+FAILED: SemanticException [Error 10326]: Invalid Constraint syntax ENABLE feature not supported yet. Please use DISABLE instead.

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/results/clientnegative/create_with_constraints_validate.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/create_with_constraints_validate.q.out b/ql/src/test/results/clientnegative/create_with_constraints_validate.q.out
index 307e8ec..b2442e8 100644
--- a/ql/src/test/results/clientnegative/create_with_constraints_validate.q.out
+++ b/ql/src/test/results/clientnegative/create_with_constraints_validate.q.out
@@ -1 +1 @@
-FAILED: SemanticException [Error 10326]: Invalid Primary Key syntax  VALIDATE feature not supported yet
+FAILED: SemanticException [Error 10326]: Invalid Constraint syntax VALIDATE feature not supported yet. Please use NOVALIDATE instead.

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/results/clientnegative/create_with_fk_constraint.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/create_with_fk_constraint.q.out b/ql/src/test/results/clientnegative/create_with_fk_constraint.q.out
new file mode 100644
index 0000000..6598d6c
--- /dev/null
+++ b/ql/src/test/results/clientnegative/create_with_fk_constraint.q.out
@@ -0,0 +1,13 @@
+PREHOOK: query: CREATE TABLE table2 (a STRING PRIMARY KEY DISABLE, b STRING)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@table2
+POSTHOOK: query: CREATE TABLE table2 (a STRING PRIMARY KEY DISABLE, b STRING)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@table2
+PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, CONSTRAINT fk1 FOREIGN KEY (x) REFERENCES table2(a) DISABLE)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@table1
+FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. InvalidObjectException(message:Child column not found: x)

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/results/clientnegative/create_with_multi_pk_constraint.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/create_with_multi_pk_constraint.q.out b/ql/src/test/results/clientnegative/create_with_multi_pk_constraint.q.out
new file mode 100644
index 0000000..200fdf5
--- /dev/null
+++ b/ql/src/test/results/clientnegative/create_with_multi_pk_constraint.q.out
@@ -0,0 +1 @@
+FAILED: SemanticException [Error 10332]: Invalid constraint definition Cannot exist more than one primary key definition for the same table

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/results/clientnegative/drop_invalid_constraint1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/drop_invalid_constraint1.q.out b/ql/src/test/results/clientnegative/drop_invalid_constraint1.q.out
index 4568ccb..2cb3996 100644
--- a/ql/src/test/results/clientnegative/drop_invalid_constraint1.q.out
+++ b/ql/src/test/results/clientnegative/drop_invalid_constraint1.q.out
@@ -1,8 +1,8 @@
-PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate)
+PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@table1
-POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate)
+POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table1

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/results/clientnegative/drop_invalid_constraint2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/drop_invalid_constraint2.q.out b/ql/src/test/results/clientnegative/drop_invalid_constraint2.q.out
index 0051131..04352b4 100644
--- a/ql/src/test/results/clientnegative/drop_invalid_constraint2.q.out
+++ b/ql/src/test/results/clientnegative/drop_invalid_constraint2.q.out
@@ -1,8 +1,8 @@
-PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate)
+PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@table2
-POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate)
+POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table2

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/results/clientnegative/drop_invalid_constraint3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/drop_invalid_constraint3.q.out b/ql/src/test/results/clientnegative/drop_invalid_constraint3.q.out
index 9c60e94..03e4bd6 100644
--- a/ql/src/test/results/clientnegative/drop_invalid_constraint3.q.out
+++ b/ql/src/test/results/clientnegative/drop_invalid_constraint3.q.out
@@ -1,8 +1,8 @@
-PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate)
+PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@table2
-POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate)
+POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk1 primary key (a) disable)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table2

http://git-wip-us.apache.org/repos/asf/hive/blob/696be9f5/ql/src/test/results/clientnegative/drop_invalid_constraint4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/drop_invalid_constraint4.q.out b/ql/src/test/results/clientnegative/drop_invalid_constraint4.q.out
index 1d93c42..473dec7 100644
--- a/ql/src/test/results/clientnegative/drop_invalid_constraint4.q.out
+++ b/ql/src/test/results/clientnegative/drop_invalid_constraint4.q.out
@@ -1,16 +1,16 @@
-PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate)
+PREHOOK: query: CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@table1
-POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable novalidate)
+POSTHOOK: query: CREATE TABLE table1 (a STRING, b STRING, constraint pk1 primary key (a) disable)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table1
-PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk2 primary key (a) disable novalidate)
+PREHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk2 primary key (a) disable)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@table2
-POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk2 primary key (a) disable novalidate)
+POSTHOOK: query: CREATE TABLE table2 (a STRING, b STRING, constraint pk2 primary key (a) disable)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@table2


Mime
View raw message