patch 4.0
This commit is contained in:
@ -15,82 +15,93 @@
|
||||
#include "sql/engine/expr/ob_expr_operator.h"
|
||||
#include "lib/container/ob_fast_array.h"
|
||||
#include "lib/container/ob_2d_array.h"
|
||||
#include "pl/ob_pl_user_type.h"
|
||||
#include "sql/engine/expr/ob_i_expr_extra_info.h"
|
||||
|
||||
namespace oceanbase {
|
||||
using namespace common;
|
||||
namespace sql {
|
||||
typedef Ob2DArray<ObObjParam, OB_MALLOC_BIG_BLOCK_SIZE, ObWrapperAllocator, false> ParamStore;
|
||||
class ObExprObjAccess : public ObExprOperator {
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
class ObObjAccessRawExpr;
|
||||
class ObExprObjAccess : public ObExprOperator
|
||||
{
|
||||
OB_UNIS_VERSION(1);
|
||||
|
||||
public:
|
||||
explicit ObExprObjAccess(common::ObIAllocator& alloc);
|
||||
class ExtraInfo;
|
||||
explicit ObExprObjAccess(common::ObIAllocator &alloc);
|
||||
virtual ~ObExprObjAccess();
|
||||
|
||||
virtual void reset();
|
||||
int assign(const ObExprOperator& other);
|
||||
inline int init_param_idxs(int64_t param_idx_cnt)
|
||||
{
|
||||
return param_idxs_.init(param_idx_cnt);
|
||||
}
|
||||
virtual int calc_resultN(
|
||||
common::ObObj& result, const common::ObObj* objs_stack, int64_t param_num, common::ObExprCtx& expr_ctx) const;
|
||||
inline void set_get_attr_func(uint64_t attr_func)
|
||||
{
|
||||
get_attr_func_ = attr_func;
|
||||
}
|
||||
inline int add_param_idx(int64_t param_idx)
|
||||
{
|
||||
return param_idxs_.push_back(param_idx);
|
||||
}
|
||||
inline const common::ObFixedArray<int64_t, common::ObIAllocator>& get_param_idxs() const
|
||||
{
|
||||
return param_idxs_;
|
||||
}
|
||||
inline void set_write(bool for_write)
|
||||
{
|
||||
for_write_ = for_write;
|
||||
}
|
||||
inline bool get_write() const
|
||||
{
|
||||
return for_write_;
|
||||
}
|
||||
inline void set_access_idx_cnt(int64_t cnt)
|
||||
{
|
||||
access_idx_cnt_ = cnt;
|
||||
}
|
||||
inline int64_t get_access_idx_cnt() const
|
||||
{
|
||||
return access_idx_cnt_;
|
||||
}
|
||||
inline void set_coll_idx(int64_t idx)
|
||||
{
|
||||
coll_idx_ = idx;
|
||||
}
|
||||
inline int64_t get_coll_idx()
|
||||
{
|
||||
return coll_idx_;
|
||||
}
|
||||
int calc_result(
|
||||
common::ObObj& result, const common::ObObj* objs_stack, int64_t param_num, const ParamStore& param_store) const;
|
||||
int assign(const ObExprOperator &other);
|
||||
inline int init_param_idxs(int64_t param_idx_cnt) { return info_.param_idxs_.init(param_idx_cnt); }
|
||||
|
||||
VIRTUAL_TO_STRING_KV(N_EXPR_TYPE, get_type_name(type_), N_EXPR_NAME, name_, N_PARAM_NUM, param_num_, N_DIM,
|
||||
row_dimension_, N_REAL_PARAM_NUM, real_param_num_, K_(get_attr_func), K_(param_idxs), K_(access_idx_cnt),
|
||||
K_(for_write), K_(coll_idx));
|
||||
ExtraInfo &get_info() { return info_; }
|
||||
|
||||
int calc_result(common::ObObj &result, const common::ObObj *objs_stack,
|
||||
int64_t param_num, const ParamStore ¶m_store) const;
|
||||
|
||||
virtual int cg_expr(ObExprCGCtx &op_cg_ctx,
|
||||
const ObRawExpr &raw_expr, ObExpr &rt_expr) const override;
|
||||
static int eval_obj_access(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
|
||||
|
||||
VIRTUAL_TO_STRING_KV(N_EXPR_TYPE, get_type_name(type_),
|
||||
N_EXPR_NAME, name_,
|
||||
N_PARAM_NUM, param_num_,
|
||||
N_DIM, row_dimension_,
|
||||
N_REAL_PARAM_NUM, real_param_num_,
|
||||
K_(info));
|
||||
|
||||
private:
|
||||
typedef common::ObFastArray<int64_t, 4> ParamArray;
|
||||
int init_param_array(
|
||||
const ParamStore& param_store, const common::ObObj* objs_stack, int64_t param_num, ParamArray& param_array) const;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ObExprObjAccess);
|
||||
public:
|
||||
struct ExtraInfo : public ObIExprExtraInfo
|
||||
{
|
||||
OB_UNIS_VERSION(1);
|
||||
public:
|
||||
typedef common::ObFastArray<int64_t, 4> ParamArray;
|
||||
ExtraInfo(common::ObIAllocator &alloc, ObExprOperatorType type);
|
||||
int from_raw_expr(const ObObjAccessRawExpr &raw_access);
|
||||
void reset();
|
||||
virtual int deep_copy(common::ObIAllocator &allocator,
|
||||
const ObExprOperatorType type,
|
||||
ObIExprExtraInfo *&copied_info) const override;
|
||||
int assign(const ExtraInfo &other);
|
||||
|
||||
int init_param_array(const ParamStore ¶m_store,
|
||||
const common::ObObj *objs_stack,
|
||||
int64_t param_num,
|
||||
ParamArray ¶m_array) const;
|
||||
|
||||
int update_coll_first_last(
|
||||
const ParamStore ¶m_store, const ObObj *objs_stack, int64_t param_num) const;
|
||||
|
||||
|
||||
int calc(ObObj &result,
|
||||
const ObObjMeta &res_type,
|
||||
const int32_t extend_size,
|
||||
const ParamStore ¶m_store,
|
||||
const common::ObObj *params,
|
||||
int64_t param_num) const;
|
||||
|
||||
TO_STRING_KV(K_(get_attr_func),
|
||||
K_(param_idxs),
|
||||
K_(access_idx_cnt),
|
||||
K_(for_write),
|
||||
K_(property_type),
|
||||
K_(coll_idx),
|
||||
K_(extend_size));
|
||||
|
||||
uint64_t get_attr_func_;
|
||||
common::ObFixedArray<int64_t, common::ObIAllocator> param_idxs_;
|
||||
int64_t access_idx_cnt_;
|
||||
bool for_write_;
|
||||
pl::ObCollectionType::PropertyType property_type_;
|
||||
int64_t coll_idx_; // index of Collection in ParamArray
|
||||
// extend size only used in static engine, the old expr get extend size from ObExprResType
|
||||
int32_t extend_size_;
|
||||
};
|
||||
private:
|
||||
uint64_t get_attr_func_;
|
||||
common::ObFixedArray<int64_t, common::ObIAllocator> param_idxs_;
|
||||
int64_t access_idx_cnt_;
|
||||
bool for_write_;
|
||||
int64_t coll_idx_;
|
||||
ExtraInfo info_;
|
||||
};
|
||||
|
||||
} // namespace sql
|
||||
|
||||
Reference in New Issue
Block a user