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

@ -14,29 +14,32 @@
#include "ob_expr_locate.h"
#include "lib/oblog/ob_log.h"
#include "share/object/ob_obj_cast.h"
#include "sql/parser/ob_item_type.h"
#include "objit/common/ob_item_type.h"
#include "sql/session/ob_sql_session_info.h"
#include "sql/engine/expr/ob_expr_instr.h"
using namespace oceanbase::common;
using namespace oceanbase::sql;
namespace oceanbase {
namespace sql {
namespace oceanbase
{
namespace sql
{
ObExprLocate::ObExprLocate(ObIAllocator& alloc)
: ObLocationExprOperator(alloc, T_FUN_SYS_LOCATE, N_LOCATE, TWO_OR_THREE, NOT_ROW_DIMENSION)
{}
ObExprLocate::ObExprLocate(ObIAllocator &alloc)
: ObLocationExprOperator(alloc, T_FUN_SYS_LOCATE, N_LOCATE, TWO_OR_THREE, NOT_ROW_DIMENSION) {}
ObExprLocate::~ObExprLocate()
{
// TODO Auto-generated destructor stub
}
int ObExprLocate::calc_result_typeN(
ObExprResType& type, ObExprResType* types_array, int64_t param_num, ObExprTypeCtx& type_ctx) const
int ObExprLocate::calc_result_typeN(ObExprResType &type,
ObExprResType *types_array,
int64_t param_num,
ObExprTypeCtx &type_ctx) const
{
int ret = OB_SUCCESS;
const ObSQLSessionInfo* session = NULL;
const ObSQLSessionInfo *session = NULL;
if (OB_ISNULL(session = type_ctx.get_session())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("session is NULL", K(ret));
@ -46,32 +49,17 @@ int ObExprLocate::calc_result_typeN(
} else if (OB_ISNULL(types_array)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected error. types_array is null", K(ret), K(types_array));
} else if (OB_FAIL(ObLocationExprOperator::calc_result_type2(type, types_array[0], types_array[1], type_ctx))) {
} else if (OB_FAIL(ObLocationExprOperator::calc_result_type2(type, types_array[0],
types_array[1], type_ctx))) {
LOG_WARN("calc result type failed", K(ret), K(types_array[0]), K(types_array[1]));
} else if (3 == param_num && session->use_static_typing_engine()) {
} else if (3 == param_num) {
types_array[2].set_calc_type(ObIntType);
ObCastMode cm = lib::is_oracle_mode() ? CM_NONE : CM_STRING_INTEGER_TRUNC | CM_WARN_ON_FAIL;
ObCastMode cm = lib::is_oracle_mode() ? CM_NONE :
CM_STRING_INTEGER_TRUNC | CM_WARN_ON_FAIL;
type_ctx.set_cast_mode(type_ctx.get_cast_mode() | cm);
}
return ret;
}
int ObExprLocate::calc_resultN(ObObj& result, const ObObj* objs_array, int64_t param_num, ObExprCtx& expr_ctx) const
{
int ret = OB_SUCCESS;
if (OB_ISNULL(expr_ctx.calc_buf_)) {
ret = OB_NOT_INIT;
LOG_WARN("calc_buf of expr_ctx is NULL", K(ret));
} else if (PARAM_NUM_TWO == param_num) {
ret = calc_result2(result, objs_array[0], objs_array[1], expr_ctx);
} else if (PARAM_NUM_THREE == param_num) {
ret = calc_result3(result, objs_array[0], objs_array[1], objs_array[2], expr_ctx);
} else {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument number for locate()", K(ret), K(param_num));
}
return ret;
}
} // namespace sql
} // namespace oceanbase
} //namespace sql
} //namespace oceanbase