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

@ -13,35 +13,52 @@
#ifndef OCEANBASE_SQL_ENGINE_EXPR_OB_EXPR_INT_DIV_H_
#define OCEANBASE_SQL_ENGINE_EXPR_OB_EXPR_INT_DIV_H_
#include "sql/engine/expr/ob_expr_operator.h"
namespace oceanbase {
namespace sql {
class ObExprIntDiv : public ObArithExprOperator {
namespace oceanbase
{
namespace sql
{
class ObExprIntDiv: public ObArithExprOperator
{
public:
ObExprIntDiv();
explicit ObExprIntDiv(common::ObIAllocator& alloc);
virtual ~ObExprIntDiv(){};
virtual int calc_result_type2(
ObExprResType& type, ObExprResType& type1, ObExprResType& type2, common::ObExprTypeCtx& type_ctx) const override;
virtual int calc_result2(
common::ObObj& res, const common::ObObj& ojb1, const common::ObObj& obj2, common::ObExprCtx& expr_ctx) const override;
static int calc(common::ObObj& res, const common::ObObj& ojb1, const common::ObObj& obj2,
common::ObIAllocator* allocator, common::ObScale scale);
static int div_int_int(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& expr_datum);
static int div_int_uint(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& expr_datum);
static int div_uint_int(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& expr_datum);
static int div_uint_uint(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& expr_datum);
static int div_number(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& expr_datum);
explicit ObExprIntDiv(common::ObIAllocator &alloc);
virtual ~ObExprIntDiv() {};
virtual int calc_result_type2(ObExprResType &type,
ObExprResType &type1,
ObExprResType &type2,
common::ObExprTypeCtx &type_ctx) const;
static int calc(common::ObObj &res,
const common::ObObj &ojb1,
const common::ObObj &obj2,
common::ObIAllocator *allocator,
common::ObScale scale);
static int div_int_int(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
static int div_int_uint(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
static int div_uint_int(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
static int div_uint_uint(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
static int div_number(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
// temporary used, remove after all expr converted
virtual int cg_expr(ObExprCGCtx& op_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const override;
virtual int cg_expr(ObExprCGCtx &op_cg_ctx,
const ObRawExpr &raw_expr,
ObExpr &rt_expr) const override;
private:
OB_INLINE static int intdiv_int(common::ObObj& res, const common::ObObj& left, const common::ObObj& right,
common::ObIAllocator* allocator, common::ObScale scale);
OB_INLINE static int intdiv_uint(common::ObObj& res, const common::ObObj& left, const common::ObObj& right,
common::ObIAllocator* allocator, common::ObScale scale);
static int intdiv_number(common::ObObj& res, const common::ObObj& left, const common::ObObj& right,
common::ObIAllocator* allocator, common::ObScale scale);
OB_INLINE static int intdiv_int(common::ObObj &res,
const common::ObObj &left,
const common::ObObj &right,
common::ObIAllocator *allocator,
common::ObScale scale);
OB_INLINE static int intdiv_uint(common::ObObj &res,
const common::ObObj &left,
const common::ObObj &right,
common::ObIAllocator *allocator,
common::ObScale scale);
static int intdiv_number(common::ObObj &res,
const common::ObObj &left,
const common::ObObj &right,
common::ObIAllocator *allocator,
common::ObScale scale);
static ObArithFunc int_div_funcs_[common::ObMaxTC];
OB_INLINE static bool is_int_int_out_of_range(int64_t val1, int64_t val2, int64_t res)
{
@ -51,11 +68,12 @@ private:
// 1 div 0 : safe.
// 1 div 1 = 0 : safe.
// 1 div 1 = 1 : overflow.
return (val1 >> 63) && (val2 >> 63) && (res >> 63);
return (val1 >> 63) && (val2 >> 63) && (res >> 63);
}
DISALLOW_COPY_AND_ASSIGN(ObExprIntDiv);
};
} // namespace sql
} // namespace oceanbase
}// sql
}// oceanbase
#endif /* OCEANBASE_SQL_ENGINE_EXPR_OB_EXPR_INT_DIV_H_ */
#endif /* OCEANBASE_SQL_ENGINE_EXPR_OB_EXPR_INT_DIV_H_ */