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

@ -15,47 +15,54 @@
#include "sql/engine/expr/ob_expr_operator.h"
namespace oceanbase {
namespace sql {
namespace oceanbase
{
namespace sql
{
class ObLocale {
public:
public:
uint decimal_point_;
uint thousand_sep_;
const char* grouping_;
ObLocale()
: decimal_point_('.'), /* decimal point en_US */
thousand_sep_(','), /* thousands_sep en_US */
grouping_("\x03\x03")
{} /* grouping en_US */
ObLocale(uint decimal_point_par, uint thousand_sep_par, const char* grouping_par)
: decimal_point_(decimal_point_par), thousand_sep_(thousand_sep_par), grouping_(grouping_par)
{}
const char *grouping_;
ObLocale() : decimal_point_('.'), /* decimal point en_US */
thousand_sep_(','), /* thousands_sep en_US */
grouping_("\x03\x03") { } /* grouping en_US */
ObLocale(uint decimal_point_par, uint thousand_sep_par, const char *grouping_par)
: decimal_point_(decimal_point_par),
thousand_sep_(thousand_sep_par),
grouping_(grouping_par) { }
};
class ObExprFormat : public ObFuncExprOperator {
class ObExprFormat : public ObFuncExprOperator
{
public:
explicit ObExprFormat(common::ObIAllocator& alloc);
explicit ObExprFormat(common::ObIAllocator &alloc);
virtual ~ObExprFormat();
virtual int calc_result_typeN(
ObExprResType& type, ObExprResType* types, int64_t param_num, common::ObExprTypeCtx& type_ctx) const override;
virtual int calc_resultN(common::ObObj& result, const common::ObObj* objs_array, int64_t param_num,
common::ObExprCtx& expr_ctx) const override;
virtual int cg_expr(ObExprCGCtx& expr_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const override;
static int calc_format_expr(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& res_datum);
virtual int calc_result_typeN(ObExprResType &type,
ObExprResType *types,
int64_t param_num,
common::ObExprTypeCtx &type_ctx) const;
virtual int cg_expr(ObExprCGCtx &expr_cg_ctx, const ObRawExpr &raw_expr,
ObExpr &rt_expr) const override;
static int calc_format_expr(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res_datum);
private:
int get_origin_param_type(ObExprResType& ori_type) const;
int convert_num_to_str(
const common::ObObj* objs_array, common::ObExprCtx& expr_ctx, int64_t scale, common::ObString& num_str) const;
int get_origin_param_type(ObExprResType &ori_type) const;
static int64_t get_format_scale(int64_t scale);
static int convert_num_to_str(const common::ObObjType& obj_type, const ObDatum& x_datum, char* buf, int64_t buf_len,
int64_t scale, common::ObString& num_str);
static int build_format_str(char* buf, const ObLocale& locale, int64_t scale, common::ObString& num_str);
int calc_result_type(ObExprResType& type, ObExprResType* types) const;
static int convert_num_to_str(const common::ObObjType &obj_type,
const ObDatum &x_datum,
char *buf,
int64_t buf_len,
int64_t scale,
common::ObString &num_str);
static int build_format_str(char *buf,
const ObLocale &locale,
int64_t scale,
common::ObString &num_str);
int calc_result_type(ObExprResType &type, ObExprResType *types) const;
DISALLOW_COPY_AND_ASSIGN(ObExprFormat);
};
} // namespace sql
} // namespace oceanbase
}
}
#endif /* OCEANBASE_SQL_ENGINE_EXPR_CHAR_H_ */