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,37 +15,52 @@
#include "sql/engine/expr/ob_expr_operator.h"
namespace oceanbase {
namespace sql {
class ObExprUnhex : public ObStringExprOperator {
namespace oceanbase
{
namespace sql
{
class ObExprUnhex : public ObStringExprOperator
{
public:
explicit ObExprUnhex(common::ObIAllocator& alloc);
explicit ObExprUnhex(common::ObIAllocator &alloc);
virtual ~ObExprUnhex();
virtual int calc_result_type1(
ObExprResType& type, ObExprResType& text, common::ObExprTypeCtx& type_ctx) const override;
static int calc(common::ObObj& result, const common::ObObj& text, common::ObCastCtx& cast_ctx, common::ObExprCtx& expr_ctx);
virtual int calc_result1(
common::ObObj& result, const common::ObObj& text, common::ObExprCtx& expr_ctx) const override;
virtual int cg_expr(ObExprCGCtx& op_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const override;
static int eval_unhex(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& res_datum);
virtual int calc_result_type1(ObExprResType &type,
ObExprResType &text,
common::ObExprTypeCtx &type_ctx) const;
virtual int cg_expr(ObExprCGCtx &op_cg_ctx,
const ObRawExpr &raw_expr,
ObExpr &rt_expr) const override;
static int eval_unhex(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &res_datum);
private:
DISALLOW_COPY_AND_ASSIGN(ObExprUnhex);
};
inline int ObExprUnhex::calc_result_type1(
ObExprResType& type, ObExprResType& text, common::ObExprTypeCtx& type_ctx) const
inline int ObExprUnhex::calc_result_type1(ObExprResType &type,
ObExprResType &text,
common::ObExprTypeCtx &type_ctx) const
{
int ret = OB_SUCCESS;
UNUSED(type_ctx);
text.set_calc_type(common::ObVarcharType);
type.set_varchar();
type.set_length(text.get_length() / 2 + (text.get_length() % 2));
if (ObTinyTextType == text.get_type()) {
const int32_t MAX_TINY_TEXT_BUFFER_SIZE = 383;
type.set_varbinary();
type.set_length(MAX_TINY_TEXT_BUFFER_SIZE);
} else if (ObTextType == text.get_type()
|| ObMediumTextType == text.get_type()
|| ObLongTextType == text.get_type()) {
type.set_type(ObLongTextType);
type.set_length(OB_MAX_LONGTEXT_LENGTH);
} else {
type.set_varchar();
type.set_length(text.get_length() / 2 + (text.get_length() % 2));
}
type.set_collation_level(common::CS_LEVEL_COERCIBLE);
type.set_collation_type(common::CS_TYPE_BINARY);
return common::OB_SUCCESS;
return ret;
}
}
}
} // namespace sql
} // namespace oceanbase
#endif /* OCEANBASE_SQL_ENGINE_EXPR_OB_EXPR_UNHEX_ */