deniskuzZ commented on code in PR #6074: URL: https://github.com/apache/hive/pull/6074#discussion_r2358475289
########## ql/src/java/org/apache/hadoop/hive/ql/ddl/table/constraint/ConstraintsUtils.java: ########## @@ -311,24 +326,22 @@ private static String getDefaultValue(ASTNode node, ASTNode typeChild, TokenRewr " .Maximum character length allowed is " + DEFAULT_MAX_LEN +" .")); } - // Make sure the default value expression type is exactly same as column's type. - TypeInfo defaultValTypeInfo = defaultValExpr.getTypeInfo(); - TypeInfo colTypeInfo = - TypeInfoUtils.getTypeInfoFromTypeString(BaseSemanticAnalyzer.getTypeStringFromAST(typeChild)); - if (!defaultValTypeInfo.equals(colTypeInfo)) { - throw new SemanticException(ErrorMsg.INVALID_CSTR_SYNTAX.getMsg("Invalid type: " + - defaultValTypeInfo.getTypeName() + " for default value: " + defaultValueText + ". Please make sure that " + - "the type is compatible with column type: " + colTypeInfo.getTypeName())); - } - // throw an error if default value isn't what hive allows if (!isDefaultValueAllowed(defaultValExpr)) { throw new SemanticException(ErrorMsg.INVALID_CSTR_SYNTAX.getMsg("Invalid Default value: " + defaultValueText + ". DEFAULT only allows constant or function expressions")); } - return defaultValueText; + return new Object[]{defaultValExpr.getTypeInfo(), defaultValueText}; } + public static void validateDefaultColumnType(TypeInfo colTypeInfo, TypeInfo defaultValTypeInfo, Review Comment: validateDefaultValueType -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org