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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]