diff --git a/deps/oblib/src/rpc/obmysql/ob_mysql_util.cpp b/deps/oblib/src/rpc/obmysql/ob_mysql_util.cpp index ce898ed4c3..0f4b921e98 100644 --- a/deps/oblib/src/rpc/obmysql/ob_mysql_util.cpp +++ b/deps/oblib/src/rpc/obmysql/ob_mysql_util.cpp @@ -898,6 +898,9 @@ int ObMySQLUtil::double_cell_str(char *buf, const int64_t len, double val, LOG_WARN("invalid input", KP(buf), K(ret)); } else { if (BINARY == type) { + if (std::fpclassify(val) == FP_ZERO && std::signbit(val)) { + val = val * -1; // if -0.0, change to 0.0 + } if (len - pos > DBL_SIZE) { MEMCPY(buf + pos, &val, DBL_SIZE); pos += DBL_SIZE; diff --git a/src/sql/ob_sql.cpp b/src/sql/ob_sql.cpp index 3d8d98c000..5615d89d45 100644 --- a/src/sql/ob_sql.cpp +++ b/src/sql/ob_sql.cpp @@ -866,6 +866,7 @@ int ObSql::fill_result_set(const ObPsStmtId stmt_id, const ObPsStmtInfo &stmt_in int ret = OB_SUCCESS; result.set_statement_id(stmt_id); result.set_stmt_type(stmt_info.get_stmt_type()); + result.set_literal_stmt_type(stmt_info.get_literal_stmt_type()); const ObPsSqlMeta &sql_meta = stmt_info.get_ps_sql_meta(); result.set_p_param_fileds(const_cast(&sql_meta.get_param_fields())); result.set_p_column_fileds(const_cast(&sql_meta.get_column_fields())); @@ -927,6 +928,8 @@ int ObSql::do_add_ps_cache(const PsCacheInfoCtx &info_ctx, } else if (OB_ISNULL(ps_stmt_item) || OB_ISNULL(ref_stmt_info)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("stmt_item or stmt_info is NULL", K(ret), KP(ps_stmt_item), KP(ref_stmt_info)); + } else { + ref_stmt_info->set_literal_stmt_type(result.get_literal_stmt_type()); } if (NULL != ref_stmt_info) { ref_stmt_info->set_is_sensitive_sql(info_ctx.is_sensitive_sql_); diff --git a/src/sql/plan_cache/ob_prepare_stmt_struct.cpp b/src/sql/plan_cache/ob_prepare_stmt_struct.cpp index 66e5d9d359..a3fd31a99a 100644 --- a/src/sql/plan_cache/ob_prepare_stmt_struct.cpp +++ b/src/sql/plan_cache/ob_prepare_stmt_struct.cpp @@ -282,7 +282,8 @@ ObPsStmtInfo::ObPsStmtInfo(ObIAllocator *inner_allocator) is_sensitive_sql_(false), raw_sql_(), raw_params_(inner_allocator), - raw_params_idx_(inner_allocator) + raw_params_idx_(inner_allocator), + literal_stmt_type_(stmt::T_NONE) { } @@ -310,7 +311,8 @@ ObPsStmtInfo::ObPsStmtInfo(ObIAllocator *inner_allocator, is_sensitive_sql_(false), raw_sql_(), raw_params_(inner_allocator), - raw_params_idx_(inner_allocator) + raw_params_idx_(inner_allocator), + literal_stmt_type_(stmt::T_NONE) { } @@ -455,6 +457,7 @@ int ObPsStmtInfo::deep_copy(const ObPsStmtInfo &other) tenant_version_ = other.tenant_version_; is_expired_ = other.is_expired_; is_expired_evicted_ = other.is_expired_evicted_; + literal_stmt_type_ = other.literal_stmt_type_; if (other.get_dep_objs_cnt() > 0) { dep_objs_cnt_ = other.get_dep_objs_cnt(); if (NULL == (dep_objs_ = reinterpret_cast diff --git a/src/sql/plan_cache/ob_prepare_stmt_struct.h b/src/sql/plan_cache/ob_prepare_stmt_struct.h index 9d43024558..eb15ca1283 100644 --- a/src/sql/plan_cache/ob_prepare_stmt_struct.h +++ b/src/sql/plan_cache/ob_prepare_stmt_struct.h @@ -150,6 +150,8 @@ public: inline int64_t get_num_of_column() const { return ps_sql_meta_.get_column_size(); } inline stmt::StmtType get_stmt_type() const { return stmt_type_; } inline void set_stmt_type(stmt::StmtType stmt_type) { stmt_type_ = stmt_type; } + inline stmt::StmtType get_literal_stmt_type() const { return literal_stmt_type_; } + inline void set_literal_stmt_type(stmt::StmtType stmt_type) { literal_stmt_type_ = stmt_type; } const ObPsSqlKey& get_sql_key() const { return ps_key_; } inline const common::ObString &get_ps_sql() const { return ps_key_.ps_sql_; } inline const common::ObString &get_no_param_sql() const { return no_param_sql_; } @@ -257,6 +259,7 @@ private: // raw_params_idx_: 0, 2 ObFixedArray raw_params_; ObFixedArray raw_params_idx_; + stmt::StmtType literal_stmt_type_; }; struct TypeInfo {