← Back to Pull requests

[fix](fe) Fix query profile ownership filtering and SQL retrieval #71280

Open
unknown opened this pull request with 479 lines diff across 5 files
View on GitHub
unknown unknown commented on Dec 02, 2026 07:29 UTC
Author

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.

  • Ran bash run-fe-ut.sh --run org.apache.doris.httpv2.rest.manager.QueryProfileActionTest on an isolated Linux development checkout with JDK 17: 14 tests, 0 failures, 0 errors, 0 skipped; BUILD SUCCESS; exit status 0. Both forwarding parameterizations passed.

  • The tested source was cf2e559dad2579f412dc6159d6b89925c89c40de plus the Jackson response-serialization test fix now included in this PR. Local and remote test-file SHA-256 matched (f6d1aec0507dee72e493b29ce1b2297d006fdcfc896d09517bf45331e76d590a).

  • The forwarding fixture uses Jackson to model HTTP response serialization; the persistence Gson omits unannotated response fields. The fixture also asserts that the serialized response contains a data object.

  • Validation was scoped to this test class; the full FEUT suite and real multi-FE HTTP integration were not run.
  • 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: Ready; targeted FEUT passed. Full-suite and real multi-FE integration coverage are outside this validation scope.
  • AI Disclosure

  • Tool: OpenAI Codex (GPT-6)

  • Generated: Implementation, unit tests, and this PR description.

  • Human review: Pending review of the generated diff.
  • Diff: 479 lines (+359 / -120) across 5 files Reviewer: morrySnow Review duration: 1277m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.46) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 479 lines diff across 5 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.369
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #71280"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.8% (MEDIUM) · Higher = larger blast radius
    45.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 24.4% · Safe to merge
    24.4%
    Repository