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

@ -16,70 +16,78 @@
#include "sql/engine/expr/ob_expr_operator.h"
#include "sql/engine/expr/ob_expr_to_temporal_base.h"
namespace oceanbase {
namespace sql {
// note: this is oracle only function
class ObExprSysTimestamp : public ObFuncExprOperator {
namespace oceanbase
{
namespace sql
{
//note: this is oracle only function
class ObExprSysTimestamp: public ObFuncExprOperator
{
public:
explicit ObExprSysTimestamp(common::ObIAllocator& alloc);
explicit ObExprSysTimestamp(common::ObIAllocator &alloc);
virtual ~ObExprSysTimestamp();
virtual int calc_result_type0(ObExprResType& type, common::ObExprTypeCtx& type_ctx) const;
virtual int calc_result0(common::ObObj& result, common::ObExprCtx& expr_ctx) const;
static int eval_systimestamp(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& expr_datum);
virtual int cg_expr(ObExprCGCtx& op_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const override;
virtual int calc_result_type0(ObExprResType &type, common::ObExprTypeCtx &type_ctx) const;
static int eval_systimestamp(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
virtual int cg_expr(ObExprCGCtx &op_cg_ctx,
const ObRawExpr &raw_expr,
ObExpr &rt_expr) const override;
private:
DISALLOW_COPY_AND_ASSIGN(ObExprSysTimestamp);
};
// note: this is oracle only function
class ObExprLocalTimestamp : public ObFuncExprOperator {
//note: this is oracle only function
class ObExprLocalTimestamp: public ObFuncExprOperator
{
public:
explicit ObExprLocalTimestamp(common::ObIAllocator& alloc);
explicit ObExprLocalTimestamp(common::ObIAllocator &alloc);
virtual ~ObExprLocalTimestamp();
virtual int calc_result_type0(ObExprResType& type, common::ObExprTypeCtx& type_ctx) const;
virtual int calc_result0(common::ObObj& result, common::ObExprCtx& expr_ctx) const;
static int eval_localtimestamp(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& expr_datum);
virtual int cg_expr(ObExprCGCtx& op_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const override;
virtual int calc_result_type0(ObExprResType &type, common::ObExprTypeCtx &type_ctx) const;
static int eval_localtimestamp(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
virtual int cg_expr(ObExprCGCtx &op_cg_ctx,
const ObRawExpr &raw_expr,
ObExpr &rt_expr) const override;
private:
DISALLOW_COPY_AND_ASSIGN(ObExprLocalTimestamp);
};
// note: this is oracle only function
class ObExprToTimestamp : public ObExprToTemporalBase {
//note: this is oracle only function
class ObExprToTimestamp: public ObExprToTemporalBase
{
public:
explicit ObExprToTimestamp(common::ObIAllocator& alloc)
: ObExprToTemporalBase(alloc, T_FUN_SYS_TO_TIMESTAMP, N_TO_TIMESTAMP)
{}
virtual ~ObExprToTimestamp()
explicit ObExprToTimestamp(common::ObIAllocator &alloc)
: ObExprToTemporalBase(alloc, T_FUN_SYS_TO_TIMESTAMP, N_TO_TIMESTAMP)
{}
virtual ~ObExprToTimestamp() {}
int set_my_result_from_ob_time(common::ObExprCtx& expr_ctx, common::ObTime& ob_time, common::ObObj& result) const;
int set_my_result_from_ob_time(common::ObExprCtx &expr_ctx,
common::ObTime &ob_time,
common::ObObj &result) const;
common::ObObjType get_my_target_obj_type() const
{
return common::ObTimestampNanoType;
}
private:
DISALLOW_COPY_AND_ASSIGN(ObExprToTimestamp);
};
// note: this is oracle only function
class ObExprToTimestampTZ : public ObExprToTemporalBase {
//note: this is oracle only function
class ObExprToTimestampTZ: public ObExprToTemporalBase
{
public:
explicit ObExprToTimestampTZ(common::ObIAllocator& alloc)
: ObExprToTemporalBase(alloc, T_FUN_SYS_TO_TIMESTAMP_TZ, N_TO_TIMESTAMP_TZ)
{}
virtual ~ObExprToTimestampTZ()
explicit ObExprToTimestampTZ(common::ObIAllocator &alloc)
: ObExprToTemporalBase(alloc, T_FUN_SYS_TO_TIMESTAMP_TZ, N_TO_TIMESTAMP_TZ)
{}
virtual ~ObExprToTimestampTZ() {}
int set_my_result_from_ob_time(common::ObExprCtx& expr_ctx, common::ObTime& ob_time, common::ObObj& result) const;
int set_my_result_from_ob_time(common::ObExprCtx &expr_ctx,
common::ObTime &ob_time,
common::ObObj &result) const;
common::ObObjType get_my_target_obj_type() const
{
return common::ObTimestampTZType;
}
private:
DISALLOW_COPY_AND_ASSIGN(ObExprToTimestampTZ);
};
@ -93,10 +101,6 @@ public:
ObExprResType *types_array,
int64_t param_num,
common::ObExprTypeCtx &type_ctx) const;
virtual int calc_resultN(common::ObObj &result,
const common::ObObj *objs_array,
int64_t param_num,
common::ObExprCtx &expr_ctx) const;
virtual common::ObCastMode get_cast_mode() const { return CM_NULL_ON_WARN;}
static int calc_timestamp1(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &result);
static int calc_timestamp2(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &result);
@ -107,7 +111,7 @@ private :
DISALLOW_COPY_AND_ASSIGN(ObExprTimestamp);
};
} // namespace sql
} // namespace oceanbase
}
}
#endif // OCEANBASE_EXPR_TIMESTAMP_H
#endif // OCEANBASE_EXPR_TIMESTAMP_H