github-actions[bot] commented on code in PR #69046:
URL: https://github.com/apache/doris/pull/69046#discussion_r4266324877
##########
be/src/exec/pipeline/pipeline_fragment_context.cpp:
##########
@@ -2757,6 +2758,26 @@ PipelineFragmentContext::collect_realtime_profile()
const {
// Make sure first profile is fragment level profile
auto fragment_profile = std::make_shared<TRuntimeProfileTree>();
_fragment_level_profile->to_thrift(fragment_profile.get(),
_runtime_state->profile_level());
+ if (auto statistics = _query_ctx->find_ai_statistics(_fragment_id)) {
+ // Copy into the fragment snapshot exactly once. Tasks never register
the shared
+ // profile as a child, and the snapshot retains no pointers into
QueryContext.
+ TRuntimeProfileTree ai_profile;
+ statistics->profile()->to_thrift(&ai_profile,
_runtime_state->profile_level());
Review Comment:
[P2] Refresh saved AI counters after recursive fragment reruns
When a recursive CTE evaluates an AI function in its recursive member (for
example, AI_GENERATE on the current iteration value),
FragmentMgr::rerun_fragment rebuilds the same fragment ID and the shared
AIExecutionStatistics keeps accumulating. Each close takes this detached
snapshot, but QueryContext::add_fragment_profile stores it with
_profile_map.insert, so every snapshot after the first is discarded.
QueryContext::_report_query_profile then sends that first snapshot as the final
report, causing both fragment details and AISummary to omit requests and tokens
from subsequent iterations; even a newer live profile is replaced by the stale
final report. Refresh the saved AI counters from the cumulative owner at final
reporting, or retain the latest snapshot for a reused fragment ID, and cover AI
work across recursive stages.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]