forked from oceanbase/oceanbase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathob_expr_abs.h
More file actions
125 lines (115 loc) · 4.64 KB
/
Copy pathob_expr_abs.h
File metadata and controls
125 lines (115 loc) · 4.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/**
* Copyright (c) 2021 OceanBase
* OceanBase CE is licensed under Mulan PubL v2.
* You can use this software according to the terms and conditions of the Mulan PubL v2.
* You may obtain a copy of Mulan PubL v2 at:
* http://license.coscl.org.cn/MulanPubL-2.0
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PubL v2 for more details.
*/
#ifndef OCEANBASE_SQL_ENGINE_EXPR_OB_EXPR_ABS_
#define OCEANBASE_SQL_ENGINE_EXPR_OB_EXPR_ABS_
#include "sql/engine/expr/ob_expr_operator.h"
namespace oceanbase
{
namespace sql
{
class ObExprAbs : public ObExprOperator
{
typedef int (*abs_func)(common::ObObj &res, const common::ObObj ¶m, common::ObExprCtx &expr_ctx);
public:
explicit ObExprAbs(common::ObIAllocator &alloc);
~ObExprAbs() {};
virtual int calc_result_type1(ObExprResType &type, ObExprResType &type1,
common::ObExprTypeCtx &type_ctx) const;
virtual int assign(const ObExprOperator &other);
virtual int cg_expr(ObExprCGCtx &expr_cg_ctx,
const ObRawExpr &raw_expr,
ObExpr &rt_expr) const override;
private:
//tinyint, mediumint, smallint, int32
static int abs_int(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//int64
static int abs_int64(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//utiniyint, umediumint, usmallint
static int abs_uint(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//uint32 uint64
static int abs_uint32_uint64(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//float
static int abs_float(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
static int abs_float_double(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//double
static int abs_double(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//ufloat
static int abs_ufloat_udouble(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//udouble
static int abs_udouble(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//number
static int abs_number(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//unumber
static int abs_unumber(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//null
static int abs_null(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//hexstring
static int abs_hexstring(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//year
static int abs_year(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//others(datetime, time, varchar,etc)
static int abs_others_double(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
static int abs_others_number(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//bit
static int abs_bit(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//bit
static int abs_enum_set(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
//json
static int abs_json(common::ObObj &res,
const common::ObObj ¶m,
common::ObExprCtx &expr_ctx);
static common::ObObjType calc_param_type(const common::ObObjType orig_param_type,
const bool is_oracle_mode);
private:
DISALLOW_COPY_AND_ASSIGN(ObExprAbs);
private:
abs_func func_;
};
} // namespace sql
} // namespace oceanbase
#endif // OCEANBASE_SQL_ENGINE_EXPR_OB_EXPR_ABS_