提交 94ba0a39 编写于 作者: O obdev 提交者: wangzelin.wzl

cherry-pick bugfix to opensource

上级 e4739239
...@@ -344,7 +344,9 @@ int ObNumber::from_sci_(const char* str, const int64_t length, IAllocator& alloc ...@@ -344,7 +344,9 @@ int ObNumber::from_sci_(const char* str, const int64_t length, IAllocator& alloc
} }
} }
if (OB_SUCC(ret) && (has_digit || 0 < i_nth) && ('e' == cur || 'E' == cur)) { if (OB_SUCC(ret) && (has_digit || 0 < i_nth)
&& ('e' == cur || 'E' == cur)
&& is_valid_sci_tail_(str, length, i)) {
LOG_DEBUG("ObNumber from sci", LOG_DEBUG("ObNumber from sci",
K(ret), K(ret),
K(i), K(i),
...@@ -6629,6 +6631,36 @@ int ObNumber::cast_to_int64(int64_t& value) const ...@@ -6629,6 +6631,36 @@ int ObNumber::cast_to_int64(int64_t& value) const
return ret; return ret;
} }
/**
* check whether a sci format string has a valid exponent part
* valid : 1.8E-1/1.8E1 invalid : 1.8E, 1.8Ea, 1.8E-a
* @param str string need to parse
* @param length length of str
* @param e_pos index of 'E'
*/
bool ObNumber::is_valid_sci_tail_(const char *str,
const int64_t length,
const int64_t e_pos)
{
bool res = false;
if (e_pos == length - 1) {
//like 1.8e, false
} else if (e_pos < length - 1) {
if ('+' == str[e_pos + 1] || '-' == str[e_pos + 1]) {
if (e_pos < length - 2 && str[e_pos + 2] >= '0' && str[e_pos + 2] <= '9') {
res = true;
} else {
//like 1.8e+, false
}
} else if (str[e_pos + 1] >= '0' && str[e_pos + 1] <= '9') {
res = true;
} else {
//like 1.8ea, false
}
}
return res;
}
void ObNumber::set_one() void ObNumber::set_one()
{ {
if (OB_ISNULL(digits_)) { if (OB_ISNULL(digits_)) {
......
...@@ -542,6 +542,9 @@ protected: ...@@ -542,6 +542,9 @@ protected:
inline static bool is_lt_1_(const Desc d) __attribute__((always_inline)); inline static bool is_lt_1_(const Desc d) __attribute__((always_inline));
inline static int exp_check_(const ObNumber::Desc& desc, const bool is_oracle_mode = false) inline static int exp_check_(const ObNumber::Desc& desc, const bool is_oracle_mode = false)
__attribute__((always_inline)); __attribute__((always_inline));
inline static bool is_valid_sci_tail_(const char *str,
const int64_t length,
const int64_t e_pos) __attribute__((always_inline));
public: public:
bool is_int64() const; bool is_int64() const;
......
...@@ -690,7 +690,9 @@ inline int ObExprGeneratorImpl::visit_in_expr(ObOpRawExpr& expr, ObExprInOrNotIn ...@@ -690,7 +690,9 @@ inline int ObExprGeneratorImpl::visit_in_expr(ObOpRawExpr& expr, ObExprInOrNotIn
bool param_all_is_ext = true; bool param_all_is_ext = true;
bool param_all_same_cs_level = true; bool param_all_same_cs_level = true;
for (int64_t j = 0; OB_SUCC(ret) && j < in_op->get_row_dimension(); ++j) { for (int64_t j = 0; OB_SUCC(ret) && j < in_op->get_row_dimension(); ++j) {
param_all_const &= param1->get_param_expr(0)->get_param_expr(j)->has_const_or_const_expr_flag(); param_all_const &= (param1->get_param_expr(0)->get_param_expr(j)->has_const_or_const_expr_flag()
&& !param1->get_param_expr(0)->get_param_expr(j)
->has_flag(IS_EXEC_PARAM));
ObObjType first_obj_type = param1->get_param_expr(0)->get_param_expr(j)->get_data_type(); ObObjType first_obj_type = param1->get_param_expr(0)->get_param_expr(j)->get_data_type();
ObObjType cur_obj_type = ObMaxType; ObObjType cur_obj_type = ObMaxType;
ObCollationType first_obj_cs_type = param1->get_param_expr(0)->get_param_expr(j)->get_collation_type(); ObCollationType first_obj_cs_type = param1->get_param_expr(0)->get_param_expr(j)->get_collation_type();
...@@ -707,7 +709,9 @@ inline int ObExprGeneratorImpl::visit_in_expr(ObOpRawExpr& expr, ObExprInOrNotIn ...@@ -707,7 +709,9 @@ inline int ObExprGeneratorImpl::visit_in_expr(ObOpRawExpr& expr, ObExprInOrNotIn
first_obj_cs_type = cur_obj_cs_type; first_obj_cs_type = cur_obj_cs_type;
} }
if (ObNullType != first_obj_type && ObNullType != cur_obj_type) { if (ObNullType != first_obj_type && ObNullType != cur_obj_type) {
param_all_const &= param1->get_param_expr(i)->get_param_expr(j)->has_const_or_const_expr_flag(); param_all_const &= (param1->get_param_expr(i)->get_param_expr(j)->has_const_or_const_expr_flag()
&& !param1->get_param_expr(i)->get_param_expr(j)
->has_flag(IS_EXEC_PARAM));
param_all_same_type &= (first_obj_type == cur_obj_type); param_all_same_type &= (first_obj_type == cur_obj_type);
param_all_same_cs_type &= (first_obj_cs_type == cur_obj_cs_type); param_all_same_cs_type &= (first_obj_cs_type == cur_obj_cs_type);
param_all_same_cs_level &= (first_obj_cs_level == cur_obj_cs_level); param_all_same_cs_level &= (first_obj_cs_level == cur_obj_cs_level);
...@@ -738,7 +742,8 @@ inline int ObExprGeneratorImpl::visit_in_expr(ObOpRawExpr& expr, ObExprInOrNotIn ...@@ -738,7 +742,8 @@ inline int ObExprGeneratorImpl::visit_in_expr(ObOpRawExpr& expr, ObExprInOrNotIn
} }
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
bool param_all_const = param1->get_param_expr(0)->has_const_or_const_expr_flag(); bool param_all_const = (param1->get_param_expr(0)->has_const_or_const_expr_flag()
&& !param1->get_param_expr(0)->has_flag(IS_EXEC_PARAM));
bool param_all_same_type = true; bool param_all_same_type = true;
bool param_all_same_cs_type = true; bool param_all_same_cs_type = true;
bool param_all_is_ext = true; bool param_all_is_ext = true;
...@@ -759,7 +764,8 @@ inline int ObExprGeneratorImpl::visit_in_expr(ObOpRawExpr& expr, ObExprInOrNotIn ...@@ -759,7 +764,8 @@ inline int ObExprGeneratorImpl::visit_in_expr(ObOpRawExpr& expr, ObExprInOrNotIn
first_obj_cs_type = cur_obj_cs_type; first_obj_cs_type = cur_obj_cs_type;
} }
if (ObNullType != first_obj_type && ObNullType != cur_obj_type) { if (ObNullType != first_obj_type && ObNullType != cur_obj_type) {
param_all_const &= param1->get_param_expr(i)->has_const_or_const_expr_flag(); param_all_const &= (param1->get_param_expr(i)->has_const_or_const_expr_flag()
&& !param1->get_param_expr(i)->has_flag(IS_EXEC_PARAM));
param_all_same_type &= (first_obj_type == cur_obj_type); param_all_same_type &= (first_obj_type == cur_obj_type);
param_all_same_cs_type &= (first_obj_cs_type == cur_obj_cs_type); param_all_same_cs_type &= (first_obj_cs_type == cur_obj_cs_type);
param_all_same_cs_level &= (first_obj_cs_level == cur_obj_cs_level); param_all_same_cs_level &= (first_obj_cs_level == cur_obj_cs_level);
......
...@@ -628,6 +628,8 @@ int ObStaticEngineCG::generate_spec(ObLogDistinct& op, ObMergeDistinctSpec& spec ...@@ -628,6 +628,8 @@ int ObStaticEngineCG::generate_spec(ObLogDistinct& op, ObMergeDistinctSpec& spec
LOG_WARN("merge distinct has no block mode", K(op.get_algo()), K(op.get_block_mode()), K(ret)); LOG_WARN("merge distinct has no block mode", K(op.get_algo()), K(op.get_block_mode()), K(ret));
} else if (OB_FAIL(spec.cmp_funcs_.init(op.get_distinct_exprs().count()))) { } else if (OB_FAIL(spec.cmp_funcs_.init(op.get_distinct_exprs().count()))) {
LOG_WARN("failed to init sort functions", K(ret)); LOG_WARN("failed to init sort functions", K(ret));
} else if (OB_FAIL(spec.distinct_exprs_.init(op.get_distinct_exprs().count()))) {
LOG_WARN("failed to init distinct exprs", K(ret));
} else { } else {
ObExpr* expr = nullptr; ObExpr* expr = nullptr;
ARRAY_FOREACH(op.get_distinct_exprs(), i) ARRAY_FOREACH(op.get_distinct_exprs(), i)
...@@ -665,6 +667,8 @@ int ObStaticEngineCG::generate_spec(ObLogDistinct& op, ObHashDistinctSpec& spec, ...@@ -665,6 +667,8 @@ int ObStaticEngineCG::generate_spec(ObLogDistinct& op, ObHashDistinctSpec& spec,
LOG_WARN("failed to init sort functions", K(ret)); LOG_WARN("failed to init sort functions", K(ret));
} else if (OB_FAIL(spec.sort_collations_.init(op.get_distinct_exprs().count()))) { } else if (OB_FAIL(spec.sort_collations_.init(op.get_distinct_exprs().count()))) {
LOG_WARN("failed to init sort functions", K(ret)); LOG_WARN("failed to init sort functions", K(ret));
} else if (OB_FAIL(spec.distinct_exprs_.init(op.get_distinct_exprs().count()))) {
LOG_WARN("failed to init distinct exprs", K(ret));
} else { } else {
ObExpr* expr = nullptr; ObExpr* expr = nullptr;
int64_t dist_cnt = 0; int64_t dist_cnt = 0;
......
...@@ -80,8 +80,10 @@ void ObDtlRpcChannel::SendBCMsgCB::on_invalid() ...@@ -80,8 +80,10 @@ void ObDtlRpcChannel::SendBCMsgCB::on_invalid()
LOG_WARN("SendBCMsgCB invalid, check object serialization impl or oom", K_(trace_id)); LOG_WARN("SendBCMsgCB invalid, check object serialization impl or oom", K_(trace_id));
AsyncCB::on_invalid(); AsyncCB::on_invalid();
ObIArray<ObDtlRpcDataResponse>& resps = result_.resps_; ObIArray<ObDtlRpcDataResponse>& resps = result_.resps_;
for (int64_t i = 0; i < resps.count() && i < responses_.count(); ++i) { for (int64_t i = 0; i < responses_.count(); ++i) {
int ret = responses_.at(i)->on_finish(resps.at(i).is_block_, OB_RPC_PACKET_INVALID); int ret_code = (OB_SUCCESS != rcode_.rcode_) ? rcode_.rcode_
: (i < resps.count() ? resps.at(i).recode_ : OB_RPC_PACKET_INVALID);
int ret = responses_.at(i)->on_finish(false, ret_code);
if (OB_FAIL(ret)) { if (OB_FAIL(ret)) {
LOG_WARN("set finish failed", K(ret), K(resps.count()), K(responses_.count()), K(trace_id_)); LOG_WARN("set finish failed", K(ret), K(resps.count()), K(responses_.count()), K(trace_id_));
} }
...@@ -93,7 +95,9 @@ void ObDtlRpcChannel::SendBCMsgCB::on_timeout() ...@@ -93,7 +95,9 @@ void ObDtlRpcChannel::SendBCMsgCB::on_timeout()
LOG_WARN("SendBCMsgCB timeout, if negative timeout, check peer cpu load, network packet drop rate", K_(trace_id)); LOG_WARN("SendBCMsgCB timeout, if negative timeout, check peer cpu load, network packet drop rate", K_(trace_id));
ObIArray<ObDtlRpcDataResponse>& resps = result_.resps_; ObIArray<ObDtlRpcDataResponse>& resps = result_.resps_;
for (int64_t i = 0; i < resps.count() && i < responses_.count(); ++i) { for (int64_t i = 0; i < resps.count() && i < responses_.count(); ++i) {
int ret = responses_.at(i)->on_finish(resps.at(i).is_block_, OB_TIMEOUT); int ret_code = (OB_SUCCESS != rcode_.rcode_) ? rcode_.rcode_
: (i < resps.count() ? resps.at(i).recode_ : OB_TIMEOUT);
int ret = responses_.at(i)->on_finish(false, ret_code);
if (OB_FAIL(ret)) { if (OB_FAIL(ret)) {
LOG_WARN("set finish failed", K(ret), K(resps.count()), K(responses_.count()), K(trace_id_)); LOG_WARN("set finish failed", K(ret), K(resps.count()), K(responses_.count()), K(trace_id_));
} }
......
...@@ -23,7 +23,7 @@ using namespace common; ...@@ -23,7 +23,7 @@ using namespace common;
namespace sql { namespace sql {
ObDistinctSpec::ObDistinctSpec(ObIAllocator& alloc, const ObPhyOperatorType type) ObDistinctSpec::ObDistinctSpec(ObIAllocator& alloc, const ObPhyOperatorType type)
: ObOpSpec(alloc, type), distinct_exprs_(), cmp_funcs_(alloc), is_block_mode_(false) : ObOpSpec(alloc, type), distinct_exprs_(alloc), cmp_funcs_(alloc), is_block_mode_(false)
{} {}
OB_SERIALIZE_MEMBER((ObDistinctSpec, ObOpSpec), distinct_exprs_, cmp_funcs_, is_block_mode_); OB_SERIALIZE_MEMBER((ObDistinctSpec, ObOpSpec), distinct_exprs_, cmp_funcs_, is_block_mode_);
......
...@@ -28,7 +28,7 @@ public: ...@@ -28,7 +28,7 @@ public:
INHERIT_TO_STRING_KV("op_spec", ObOpSpec, K_(distinct_exprs), K_(is_block_mode), K_(cmp_funcs)); INHERIT_TO_STRING_KV("op_spec", ObOpSpec, K_(distinct_exprs), K_(is_block_mode), K_(cmp_funcs));
// data members // data members
common::ObSEArray<ObExpr*, 4> distinct_exprs_; common::ObFixedArray<ObExpr*, common::ObIAllocator> distinct_exprs_;
common::ObCmpFuncs cmp_funcs_; common::ObCmpFuncs cmp_funcs_;
bool is_block_mode_; bool is_block_mode_;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册