Skip to content

feat: add sys.query_context_parameters system table - #223

Closed
FrankChen021 wants to merge 9 commits into
codex/migrate-query-context-referencefrom
codex/sys-query-context-parameters
Closed

FrankChen021 wants to merge 9 commits into
codex/migrate-query-context-referencefrom
codex/sys-query-context-parameters

Conversation

@FrankChen021

@FrankChen021 FrankChen021 commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Description

Stacked on apache#20556. Adds sys.query_context_parameters, which lists the query context parameters users can set, built from the QueryContextParameters catalog. INTERNAL parameters are excluded. Descriptions are normalized to one line when the descriptor is built; an enum's description lists its accepted values.

Column Type
name, type, range, default_value, effective_value, effective_source, default_description, description, visibility, since, deprecation_message VARCHAR
query_languages (SQL, JSON), engines, native_query_types, statement_types ARRAY
is_nullable, is_deprecated BIGINT

default_value is the built-in default. 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 built-in default; effective_source says which. A null in the dynamic configuration unsets the key, so the built-in default applies. QueryConfigProvider gains getDynamicContext() so the table can tell the dynamic overrides apart.

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.

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 web console's SQL editor now loads the public parameters from this table and suggests them after SET, with each parameter's type, description, default and deprecation in the completion popup. Without CONFIG read access it shows the built-in default and notes that the Broker may override it. If the table can't be read (an older Druid), it falls back to the previous fixed list.

CloneQueryMode now serializes by its JSON name (excludeClones), the same fix as apache#20557, so its default_value matches what queries accept.

The table runs on the Bindable path, where array columns can be selected and indexed but not used with Druid array functions such as ARRAY_CONTAINS. Those need the native system-table path (apache#20183).


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.

Copilot AI balanced review requested due to automatic review settings October 11, 2026 15:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@FrankChen021
FrankChen021 force-pushed the codex/migrate-sql-query-context branch 2 times, most recently from 645f387 to cb1d66d Compare October 12, 2026 03:06
@FrankChen021
FrankChen021 force-pushed the codex/migrate-sql-query-context branch from cb1d66d to afbc84f Compare October 12, 2026 03:12
@FrankChen021
FrankChen021 force-pushed the codex/sys-query-context-parameters branch from 64571df to 73db462 Compare October 12, 2026 06:57
@FrankChen021
FrankChen021 force-pushed the codex/migrate-sql-query-context branch 2 times, most recently from d6c60cb to f4c0c6a Compare October 12, 2026 08:34
@FrankChen021
FrankChen021 force-pushed the codex/sys-query-context-parameters branch from 64489b5 to ca848b9 Compare October 12, 2026 10:25
@FrankChen021
FrankChen021 force-pushed the codex/migrate-sql-query-context branch from f4c0c6a to 752ea44 Compare October 13, 2026 06:05
@FrankChen021
FrankChen021 force-pushed the codex/sys-query-context-parameters branch from a124bc1 to 039f60a Compare October 13, 2026 06:08
@FrankChen021
FrankChen021 force-pushed the codex/migrate-sql-query-context branch from 752ea44 to de3fcb1 Compare October 13, 2026 06:11
@FrankChen021
FrankChen021 force-pushed the codex/sys-query-context-parameters branch from 039f60a to f33b7dd Compare October 13, 2026 06:11
@FrankChen021
FrankChen021 force-pushed the codex/migrate-sql-query-context branch from de3fcb1 to 9a0056a Compare October 13, 2026 06:12
@FrankChen021
FrankChen021 force-pushed the codex/sys-query-context-parameters branch from f33b7dd to 85f70c5 Compare October 13, 2026 06:13
@FrankChen021
FrankChen021 force-pushed the codex/migrate-sql-query-context branch from 9a0056a to 1ba7ad6 Compare October 13, 2026 07:00
@FrankChen021
FrankChen021 force-pushed the codex/sys-query-context-parameters branch from 85f70c5 to e631e4e Compare October 13, 2026 07:04
@FrankChen021
FrankChen021 changed the base branch from codex/migrate-sql-query-context to codex/migrate-query-context-reference October 13, 2026 07:04
@FrankChen021
FrankChen021 force-pushed the codex/sys-query-context-parameters branch from 7590609 to 5f15f94 Compare October 13, 2026 08:25
@FrankChen021
FrankChen021 force-pushed the codex/sys-query-context-parameters branch from 67833f6 to 40c54ec Compare October 13, 2026 09:33
gianm and others added 2 commits October 13, 2026 11:15
…ache#20541)

Addresses four problems:

1) Provide PhysicalSegmentColumnInspector from PartialQueryableIndexSegment.
   Previously it was not provided, so segmentMetadata queries were not
   able to report types.

2) Look at all cluster groups when determining capabilities, not just
   the first one. (They can differ in the details, like auto-determined
   type and hasMultipleValues.)

3) Use the DimensionIndexer's ColumnFormat when writing columns in
   cluster groups and projections. Previously the ColumnFormat present
   at creation time was used, which could differ in details (such as
   hasMultipleValues). This caused multi-valued columns to be
   incorrectly persisted, in situations where the persist logic did
   not realize they were multi-value.

4) Updates Capable.or and Capable.and to use correct 3-valued logic.
   This made certain new code simpler to write, and as far as I can
   tell, will only have positive effects on existing callers.
CodeQL Action v3 runs on Node.js 20 and is deprecated in December 2026. v4 runs on Node.js 24.
amaechler and others added 5 commits October 14, 2026 14:03
* Enable Dependabot version updates for GitHub Actions

* Exempt codeql-action from the GitHub Actions cooldown

* Trim cooldown comments

* Use a 7-day cooldown for GitHub Actions instead of exempting codeql-action
…he#20450)

* perf: cache incremental-index expression plans

* fix: avoid sharing mutable expression state

* fix: return fresh expressions from plan cache

* test: use daemon executor for expression cache concurrency

* docs: explain expression plan cache array

* perf: reuse expression selectors during ingestion

* test: cover expression selector reuse with arrays

* test: clarify expression ingestion expectation

* perf: add expression ingestion benchmark

* fix: reevaluate non-deterministic ingestion expressions
* refactor: migrate query context reference parameters

* fix: address review findings on query context descriptors

- Merge the user context over default contexts with QueryContexts.withDefaults, so a null user value falls back to the configured default on both the SQL and native paths.
- Declare maxSubqueryBytes as a string parameter that accepts the forms the subquery guardrail accepts.
- Deprecate the key constants replaced by descriptors for removal, and migrate their remaining uses.
- Escape default descriptions and ignore CRLF line endings in the generated documentation check.

* fix: address second review of query context descriptors
@FrankChen021
FrankChen021 force-pushed the codex/sys-query-context-parameters branch from cf0cc4c to d0ad0c7 Compare October 14, 2026 06:36
@github-actions github-actions Bot added the GHA label Oct 14, 2026
Lists the query context parameters users can set, with their types, defaults, applicability and the default the Broker applies. Also renames Visibility.INTERNAL to SYSTEM.
@FrankChen021
FrankChen021 force-pushed the codex/sys-query-context-parameters branch from d0ad0c7 to a292a85 Compare October 14, 2026 07:04
@FrankChen021

Copy link
Copy Markdown
Owner Author

Split: system table moved upstream to apache#20586; web console change in #226.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants