Fix functional index bugs

This commit is contained in:
2149
2023-05-22 04:41:42 +00:00
committed by ob-robot
parent 4f762fb2b0
commit 863d7dfd92
8 changed files with 48 additions and 4 deletions

View File

@ -26,7 +26,7 @@ namespace sql
{
ObExprDateFormat::ObExprDateFormat(ObIAllocator &alloc)
: ObStringExprOperator(alloc, T_FUN_SYS_DATE_FORMAT, N_DATE_FORMAT, 2, VALID_FOR_GENERATED_COL)
: ObStringExprOperator(alloc, T_FUN_SYS_DATE_FORMAT, N_DATE_FORMAT, 2, NOT_VALID_FOR_GENERATED_COL)
{
}
@ -143,6 +143,21 @@ int ObExprDateFormat::calc_date_format_invalid(const ObExpr &expr, ObEvalCtx &ct
return ret;
}
int ObExprDateFormat::is_valid_for_generated_column(const ObRawExpr*expr, const common::ObIArray<ObRawExpr *> &exprs, bool &is_valid) const {
int ret = OB_SUCCESS;
is_valid = true;
if (exprs.count() < 1) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected param num", K(ret), K(exprs.count()));
} else if (OB_ISNULL(exprs.at(0))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("invalid param", K(ret), K(exprs.at(0)), K(exprs.at(1)));
} else if (ObTimeType == exprs.at(0)->get_result_type().get_type() || ObTimestampType == exprs.at(0)->get_result_type().get_type()) {
is_valid = false;
}
return ret;
}
const char* ObExprGetFormat::FORMAT_STR[FORMAT_MAX] =
{
"EUR",