yiguolei opened a new pull request, #71280:
URL: https://github.com/apache/doris/pull/71280

   ### Background
   
   The FE v2 query APIs read retained profiles from ProfileManager. The query 
list uses a legacy HTTP column order, while the SQL endpoint reads the summary 
column order. Ordinary users are restricted to their own profiles; built-in 
root/admin users can view all profiles.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #19219 (introduced the summary layout used by the SQL endpoint), 
#43724 (introduced the current query_info layout)
   PR Type: Bugfix
   
   Problem Summary:
   
   Both layouts were passed to a filter that treated column 1 as the owner. 
That column is an unfilled node field in query_info and the task type in the 
SQL endpoint. The SQL endpoint also returned column 3 (end time) instead of 
SQL. Resolve fields using each endpoint's column names so ownership filtering 
and SQL retrieval use the intended values. Most of the diff adds regression 
unit tests.
   
   ### Details
   
   - **Frequency:** Deterministic when affected retained profiles are accessed; 
no concurrency is required.
   - **Root cause:** Profile column order changed without updating consumers 
that used fixed numeric indexes.
   - **Why existing tests missed it:** QueryProfileActionTest covered 
current-query column normalization, not retained-profile ownership filtering or 
SQL retrieval.
   - **Fix:** Pass the source column names into the shared filter, resolve User 
and Profile ID once, and reject a schema missing either field. Resolve SQL, 
task type, and node positions by name as well. A missing owner does not match 
an ordinary caller.
   - **Other paths and branches:** Both local endpoints are fixed together; 
all-node requests invoke those local endpoints. The HTTP column order and 
existing root/admin policy are preserved. No release-branch backport is 
included.
   - **Behavior change:** Ordinary users can retrieve their own retained query 
records, other users' records remain filtered, and authorized SQL requests 
return SQL rather than an end timestamp.
   
   ### Testing
   
   - Passed `git diff --check` locally and inspected the final diff.
   - Added parameterized unit tests for ordinary users, a username matching the 
Query task type, root/admin, own and foreign records, nonexistent IDs, null 
node fields, empty profiles, and missing owners.
   - Added simulated two-FE forwarding tests that exercise the local handlers 
and check forwarded credentials and aggregation. These do not start real FE 
servers.
   - Builds and tests have not been run, per the author's requested workflow. 
No before/after runtime result is claimed.
   
   ### Release note
   
   Fix FE v2 query profile APIs to filter records by their actual owner and 
return the query SQL instead of its end time, while preserving the existing 
response format.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: No
   - Pre-submission status: Partially verified: source and whitespace checks 
completed; compilation and test execution pending.
   
   ### AI Disclosure
   
   - Tool: OpenAI Codex (GPT-6)
   - Generated: Implementation, unit tests, and this PR description.
   - Human review: Pending review of the generated diff.
   


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