github-actions[bot] commented on code in PR #69046:
URL: https://github.com/apache/doris/pull/69046#discussion_r4278182080


##########
fe/fe-core/src/main/java/org/apache/doris/common/profile/Profile.java:
##########
@@ -481,6 +484,16 @@ private RecentRunsPlanStatistics updatePlanStatistics(
         return new RecentRunsPlanStatistics(newRecentRunsStatistics);
     }
 
+    private RuntimeProfile getAIFunctionSummary() {
+        RuntimeProfile summary = new RuntimeProfile("AIFunctionSummary");
+        // Loads and query retries can contain multiple executions; each 
contributes once to the totals.
+        for (ExecutionProfile executionProfile : executionProfiles) {

Review Comment:
   [P2] Preserve AI totals from discarded query attempts
   
   With FE query retries enabled, an AI query can complete its provider calls 
before the first result-fetch RPC fails (the existing 
`ResultReceiver.getNext.dropDataBatch` hook models this). 
`StmtExecutor.finalizeQuery(true)` then calls 
`Profile.clearExecutionProfiles()`, which clears this list and removes the 
failed query ID from `ProfileManager`. This loop therefore reports only the 
successful retry, and late final reports cannot restore the discarded 
request/token counters. For a one-row query making one request with 10 tokens 
per attempt, the summary shows 1 request/10 tokens after a retry although the 
provider processed 2 requests/20 tokens. Preserve failed-attempt AI statistics 
and their pending reports separately from discarded plan/row statistics, and 
cover the actual FE retry path in a test.



-- 
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]

Reply via email to