diff --git a/src/sql/engine/px/ob_dfo.cpp b/src/sql/engine/px/ob_dfo.cpp index 511b1089c6..c60a810744 100644 --- a/src/sql/engine/px/ob_dfo.cpp +++ b/src/sql/engine/px/ob_dfo.cpp @@ -29,7 +29,7 @@ OB_SERIALIZE_MEMBER(ObP2PDhMapInfo, p2p_sequence_ids_, target_addrs_); -OB_SERIALIZE_MEMBER(ObQCMonitoringInfo, sql_, qc_tid_); +OB_SERIALIZE_MEMBER(ObQCMonitoringInfo, cur_sql_, qc_tid_); OB_SERIALIZE_MEMBER(ObPxSqcMeta, execution_id_, @@ -99,24 +99,24 @@ OB_SERIALIZE_MEMBER(ObPxCleanDtlIntermResArgs, info_, batch_size_); int ObQCMonitoringInfo::init(const ObExecContext &exec_ctx) { int ret = OB_SUCCESS; qc_tid_ = GETTID(); - if (OB_NOT_NULL(exec_ctx.get_sql_ctx())) { - sql_ = exec_ctx.get_sql_ctx()->cur_sql_; + if (OB_NOT_NULL(exec_ctx.get_my_session())) { + cur_sql_ = exec_ctx.get_my_session()->get_current_query_string(); } - if (sql_.length() > ObQCMonitoringInfo::LIMIT_LENGTH) { - sql_.set_length(ObQCMonitoringInfo::LIMIT_LENGTH); + if (cur_sql_.length() > ObQCMonitoringInfo::LIMIT_LENGTH) { + cur_sql_.assign(cur_sql_.ptr(), ObQCMonitoringInfo::LIMIT_LENGTH); } return ret; } int ObQCMonitoringInfo::assign(const ObQCMonitoringInfo &other) { int ret = OB_SUCCESS; - sql_ = other.sql_; + cur_sql_ = other.cur_sql_; qc_tid_ = other.qc_tid_; return ret; } void ObQCMonitoringInfo::reset() { - sql_.reset(); + cur_sql_.reset(); } int ObPxSqcMeta::assign(const ObPxSqcMeta &other) diff --git a/src/sql/engine/px/ob_dfo.h b/src/sql/engine/px/ob_dfo.h index 1c56c1c6c3..24a65c53bb 100644 --- a/src/sql/engine/px/ob_dfo.h +++ b/src/sql/engine/px/ob_dfo.h @@ -189,12 +189,12 @@ public: int assign(const ObQCMonitoringInfo &other); void reset(); public: - common::ObString sql_; + common::ObString cur_sql_; // in nested px situation, it is the current px coordinator's thread id int64_t qc_tid_; // no need to deserialize static constexpr int64_t LIMIT_LENGTH = 100; - TO_STRING_KV(K_(sql), K_(qc_tid)); + TO_STRING_KV(K_(cur_sql), K_(qc_tid)); }; // PX 端描述每个 SQC 的数据结构