diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java index 40039ac39d..2e2191fc37 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java @@ -1001,7 +1001,7 @@ private static void generateConstraintInfos(ASTNode child, List columnNa // it will be considered ENABLE and NOVALIDATE and RELY=false boolean enable = true; boolean validate = false; - boolean rely = false; + boolean rely = true; String checkOrDefaultValue = null; for (int i = 0; i < child.getChildCount(); i++) { ASTNode grandChild = (ASTNode) child.getChild(i); @@ -1018,6 +1018,7 @@ private static void generateConstraintInfos(ASTNode child, List columnNa enable = false; // validate is false by default if we disable the constraint validate = false; + rely = false; } else if (type == HiveParser.TOK_VALIDATE) { validate = true; } else if (type == HiveParser.TOK_NOVALIDATE) { 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 d581c602c3..f4d12ae564 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 @@ -2252,7 +2252,7 @@ relySpecification @init { pushMsg("rely specification", state); } @after { popMsg(state); } : KW_RELY -> ^(TOK_RELY) - | (KW_NORELY)? -> ^(TOK_NORELY) + | KW_NORELY -> ^(TOK_NORELY) ; createConstraint @@ -2508,11 +2508,11 @@ tableConstraintType ; constraintOptsCreate - : enableValidateSpecification relySpecification + : enableValidateSpecification relySpecification? ; constraintOptsAlter - : enableValidateSpecification relySpecification + : enableValidateSpecification relySpecification? ; columnNameColonType