Ps bug repair about add literal_stmt_type_ in PsStmtInfo and check -0.0 in double_cell_str
This commit is contained in:
		
							
								
								
									
										3
									
								
								deps/oblib/src/rpc/obmysql/ob_mysql_util.cpp
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								deps/oblib/src/rpc/obmysql/ob_mysql_util.cpp
									
									
									
									
										vendored
									
									
								
							@ -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));
 | 
					    LOG_WARN("invalid input", KP(buf), K(ret));
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    if (BINARY == type) {
 | 
					    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) {
 | 
					      if (len - pos > DBL_SIZE) {
 | 
				
			||||||
        MEMCPY(buf + pos, &val, DBL_SIZE);
 | 
					        MEMCPY(buf + pos, &val, DBL_SIZE);
 | 
				
			||||||
        pos += DBL_SIZE;
 | 
					        pos += DBL_SIZE;
 | 
				
			||||||
 | 
				
			|||||||
@ -866,6 +866,7 @@ int ObSql::fill_result_set(const ObPsStmtId stmt_id, const ObPsStmtInfo &stmt_in
 | 
				
			|||||||
  int ret = OB_SUCCESS;
 | 
					  int ret = OB_SUCCESS;
 | 
				
			||||||
  result.set_statement_id(stmt_id);
 | 
					  result.set_statement_id(stmt_id);
 | 
				
			||||||
  result.set_stmt_type(stmt_info.get_stmt_type());
 | 
					  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();
 | 
					  const ObPsSqlMeta &sql_meta = stmt_info.get_ps_sql_meta();
 | 
				
			||||||
  result.set_p_param_fileds(const_cast<common::ParamsFieldIArray *>(&sql_meta.get_param_fields()));
 | 
					  result.set_p_param_fileds(const_cast<common::ParamsFieldIArray *>(&sql_meta.get_param_fields()));
 | 
				
			||||||
  result.set_p_column_fileds(const_cast<common::ParamsFieldIArray *>(&sql_meta.get_column_fields()));
 | 
					  result.set_p_column_fileds(const_cast<common::ParamsFieldIArray *>(&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)) {
 | 
					    } else if (OB_ISNULL(ps_stmt_item) || OB_ISNULL(ref_stmt_info)) {
 | 
				
			||||||
      ret = OB_ERR_UNEXPECTED;
 | 
					      ret = OB_ERR_UNEXPECTED;
 | 
				
			||||||
      LOG_WARN("stmt_item or stmt_info is NULL", K(ret), KP(ps_stmt_item), KP(ref_stmt_info));
 | 
					      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) {
 | 
					    if (NULL != ref_stmt_info) {
 | 
				
			||||||
      ref_stmt_info->set_is_sensitive_sql(info_ctx.is_sensitive_sql_);
 | 
					      ref_stmt_info->set_is_sensitive_sql(info_ctx.is_sensitive_sql_);
 | 
				
			||||||
 | 
				
			|||||||
@ -282,7 +282,8 @@ ObPsStmtInfo::ObPsStmtInfo(ObIAllocator *inner_allocator)
 | 
				
			|||||||
    is_sensitive_sql_(false),
 | 
					    is_sensitive_sql_(false),
 | 
				
			||||||
    raw_sql_(),
 | 
					    raw_sql_(),
 | 
				
			||||||
    raw_params_(inner_allocator),
 | 
					    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),
 | 
					    is_sensitive_sql_(false),
 | 
				
			||||||
    raw_sql_(),
 | 
					    raw_sql_(),
 | 
				
			||||||
    raw_params_(inner_allocator),
 | 
					    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_;
 | 
					    tenant_version_ = other.tenant_version_;
 | 
				
			||||||
    is_expired_ = other.is_expired_;
 | 
					    is_expired_ = other.is_expired_;
 | 
				
			||||||
    is_expired_evicted_ = other.is_expired_evicted_;
 | 
					    is_expired_evicted_ = other.is_expired_evicted_;
 | 
				
			||||||
 | 
					    literal_stmt_type_ = other.literal_stmt_type_;
 | 
				
			||||||
    if (other.get_dep_objs_cnt() > 0) {
 | 
					    if (other.get_dep_objs_cnt() > 0) {
 | 
				
			||||||
      dep_objs_cnt_ = other.get_dep_objs_cnt();
 | 
					      dep_objs_cnt_ = other.get_dep_objs_cnt();
 | 
				
			||||||
      if (NULL == (dep_objs_ = reinterpret_cast<ObSchemaObjVersion *>
 | 
					      if (NULL == (dep_objs_ = reinterpret_cast<ObSchemaObjVersion *>
 | 
				
			||||||
 | 
				
			|||||||
@ -150,6 +150,8 @@ public:
 | 
				
			|||||||
  inline int64_t get_num_of_column() const { return ps_sql_meta_.get_column_size(); }
 | 
					  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 stmt::StmtType get_stmt_type() const { return stmt_type_; }
 | 
				
			||||||
  inline void set_stmt_type(stmt::StmtType stmt_type) { stmt_type_ = 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_; }
 | 
					  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_ps_sql() const { return ps_key_.ps_sql_; }
 | 
				
			||||||
  inline const common::ObString &get_no_param_sql() const { return no_param_sql_; }
 | 
					  inline const common::ObString &get_no_param_sql() const { return no_param_sql_; }
 | 
				
			||||||
@ -257,6 +259,7 @@ private:
 | 
				
			|||||||
  // raw_params_idx_: 0, 2
 | 
					  // raw_params_idx_: 0, 2
 | 
				
			||||||
  ObFixedArray<ObPCParam *, common::ObIAllocator> raw_params_;
 | 
					  ObFixedArray<ObPCParam *, common::ObIAllocator> raw_params_;
 | 
				
			||||||
  ObFixedArray<int64_t, common::ObIAllocator> raw_params_idx_;
 | 
					  ObFixedArray<int64_t, common::ObIAllocator> raw_params_idx_;
 | 
				
			||||||
 | 
					  stmt::StmtType literal_stmt_type_;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct TypeInfo {
 | 
					struct TypeInfo {
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user