← Back to Pull requests

feat: add experimental sys.query_context_parameters system table #20586

Closed
unknown closed this pull request without merging on Oct 20, 2026 02:18 UTC
View on GitHub
unknown unknown commented on Oct 14, 2026 07:05 UTC
Author

Description

Follow-up to #20555, #20578 and #20579 .

Adds sys.query_context_parameters, which lists the query context parameters users can set, built from the QueryContextParameters catalog. SYSTEM parameters, which only Druid sets, are excluded. This PR also renames the Visibility.INTERNAL level added in #20555 to SYSTEM; Visibility has not been released yet. Descriptions are normalized to one line when the descriptor is built.

The table is documented as experimental, so that its columns and their values can still change in future releases.

Descriptor changes

  • QueryContextParameter declares its default as a DefaultValue: none, a literal, or a runtime property (DefaultValue.fromProperty("druid...")). getDefaultValue() returns it, and getLiteralDefault() returns the literal default or null. Parameters whose default is the value of a runtime property, such as timeout, maxQueuedBytes and the SQL planner parameters backed by druid.sql.planner.*, now declare that property instead of describing it in defaultDescription.

  • Placeholder default descriptions such as ` null and N/A are removed, so default_description only explains defaults that can't be expressed as a single value.

  • QueryContextParameter.Type, inferred from the value type when the descriptor is built, is what the type column shows. A value type without a corresponding type is rejected.
  • | Column | Type |
    |---|---|
    |
    name, type, value_range, default_value, effective_value, effective_source, default_description, description, visibility, since, deprecation | VARCHAR |
    |
    query_languages (SQL, JSON), engines, native_query_types, statement_types | ARRAY<VARCHAR> |
    |
    is_nullable | BIGINT |

    NOTE

    The table runs on the Bindable path, where array columns can be selected, compared, sorted and indexed but not used with Druid array functions such as ARRAY_CONTAINS. This intended as we will finally support the native query path for system tables via #20183

  • default_value is the built-in default, or ${property}, such as ${druid.server.http.defaultQueryTimeout}, for a default that is the value of a runtime property.

  • effective_value is the default this Broker applies when a query doesn't set the parameter: the Broker dynamic configuration's queryContext, else the druid.query.default.context.<name> runtime property, else the runtime property in default_value as set on this Broker, else the built-in default.

  • effective_source says which: BROKER_DYNAMIC_CONFIG, DEFAULT_CONTEXT_PROPERTY, RUNTIME_PROPERTY or BUILT_IN. A null in the dynamic configuration unsets druid.query.default.context.<name>. QueryConfigProvider gains getContextWithOverrides(), which returns the effective context and the dynamic overrides from one config snapshot, so the table can tell them apart.

  • native_query_types uses the native queryType names, such as scan and groupBy.

  • native_query_types and statement_types are empty when a parameter applies to all native query types or statement types, and null when it doesn't apply to native queries or SQL at all.
  • the demo of the table (after the web console support is added)
    <img width="1380" height="571" alt="image" src="https://github.com/user-attachments/assets/e5d681b9-c7b6-4e35-8ef3-74c91836125d" />

    Authorization

    Unlike sys.servers, the table doesn't require STATE READ: any user who can query sys tables can read the catalog. Only the effective defaults come from Broker configuration, so without READ on the CONFIG resource the query still succeeds, but effective_value is null and effective_source is UNAUTHORIZED` in every row.

    <hr>

    This PR has:

  • been self-reviewed.

  • added documentation for new or modified features or behaviors.

  • added unit tests or modified existing tests to cover new code paths.

  • test in a cluster
  • Diff: 501 lines (+375 / -126) across 6 files Reviewer: GWphua Review duration: 8353m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 501 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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.372
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #20586"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 47.5% (MEDIUM) · Higher = larger blast radius
    47.5%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 18.8% · Safe to merge
    18.8%
    Repository