patch 4.0

This commit is contained in:
wangzelin.wzl
2022-10-24 10:34:53 +08:00
parent 4ad6e00ec3
commit 93a1074b0c
10533 changed files with 2588271 additions and 2299373 deletions

View File

@ -17,17 +17,23 @@
#include "sql/ob_sql_utils.h"
using namespace oceanbase::common;
namespace oceanbase {
namespace sql {
namespace oceanbase
{
namespace sql
{
ObExprFunValues::ObExprFunValues(ObIAllocator& alloc)
ObExprFunValues::ObExprFunValues(ObIAllocator &alloc)
: ObFuncExprOperator(alloc, T_FUN_SYS_VALUES, N_VALUES, 1, NOT_ROW_DIMENSION)
{}
{
}
ObExprFunValues::~ObExprFunValues()
{}
{
}
int ObExprFunValues::calc_result_type1(ObExprResType& type, ObExprResType& text, common::ObExprTypeCtx& type_ctx) const
int ObExprFunValues::calc_result_type1(ObExprResType &type,
ObExprResType &text,
common::ObExprTypeCtx &type_ctx) const
{
UNUSED(type_ctx);
type.set_type(text.get_type());
@ -37,26 +43,7 @@ int ObExprFunValues::calc_result_type1(ObExprResType& type, ObExprResType& text,
return OB_SUCCESS;
}
int ObExprFunValues::calc_result1(ObObj& result, const ObObj& text, ObExprCtx& expr_ctx) const
{
int ret = OB_SUCCESS;
if (OB_ISNULL(expr_ctx.phy_plan_ctx_) || OB_ISNULL(expr_ctx.phy_plan_ctx_->get_phy_plan())) {
ret = OB_ERR_UNEXPECTED;
SQL_ENG_LOG(WARN, "invalid phy plan ctx", K(expr_ctx.phy_plan_ctx_));
} else if (OB_FAIL(ObSQLUtils::set_compatible_cast_mode((expr_ctx).my_session_, (expr_ctx).cast_mode_))) {
SQL_ENG_LOG(WARN, "set_compatible_cast_mode failed", K(ret));
} else {
if (ObSQLUtils::is_insert_update_scope(expr_ctx.cast_mode_)) {
result = text;
} else {
result.set_null();
}
}
return ret;
}
int ObExprFunValues::cg_expr(ObExprCGCtx&, const ObRawExpr&, ObExpr& rt_expr) const
int ObExprFunValues::cg_expr(ObExprCGCtx &, const ObRawExpr &, ObExpr &rt_expr) const
{
int ret = OB_SUCCESS;
CK(1 == rt_expr.arg_cnt_);
@ -64,14 +51,14 @@ int ObExprFunValues::cg_expr(ObExprCGCtx&, const ObRawExpr&, ObExpr& rt_expr) co
return ret;
}
int ObExprFunValues::eval_values(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& expr_datum)
int ObExprFunValues::eval_values(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum)
{
// values() meaningful only in insert on duplicate update clause (extra_ set to 1),
// return NULL otherwise.
int ret = OB_SUCCESS;
if (expr.extra_) {
// in insert update scope
ObDatum* arg = NULL;
ObDatum *arg = NULL;
if (OB_FAIL(expr.eval_param_value(ctx, arg))) {
LOG_WARN("evaluate parameter value failed", K(ret));
} else {
@ -84,5 +71,5 @@ int ObExprFunValues::eval_values(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& ex
return ret;
}
} // namespace sql
} // namespace oceanbase
}
}