FrankChen021 opened a new pull request, #20198: URL: https://github.com/apache/druid/pull/20198
### Description This PR introduces typed, centrally declared query context parameters and migrates two representative parameters end to end: - `useResultLevelCache`, a Boolean parameter with a declared default. - `maxRowsQueuedForOrdering`, an Integer parameter with a runtime fallback and a range constraint. The goal is to establish and demonstrate the parameter model with a small, reviewable change before migrating the remaining query context parameters. ### Background [Issue #17769](https://github.com/apache/druid/issues/17769) proposes improving query context discoverability and validation. The closed [PR #18087](https://github.com/apache/druid/pull/18087) explored a centralized registry, a system table, and broad migration of existing parameters, but touched more than 100 files. This PR extracts a smaller end-to-end foundation from that work. It deliberately catalogs only two parameters with different types and migrates their call sites completely. **Complete validation of SQL `SET` parameters is not implemented in this PR.** The `SET` processing path calls the catalog validation API to demonstrate the intended integration, but only the two migrated parameters are recognized. Unknown and unmigrated parameter names continue to be accepted until the catalog migration is complete. ### Changes #### Parameter model and catalog Adds `QueryContextParameter<T>` and the centralized `QueryContextParameters` catalog. A descriptor contains its name, Java type, parser, nullability, optional default, constraints, deprecation message, and documentation metadata. The immutable `BY_NAME` catalog is derived from the declared public parameter fields. #### Typed context APIs and call-site migration Migrated these two parameters to demonstrate the APIs of above models: - `useResultLevelCache`, a Boolean parameter with a declared default. - `maxRowsQueuedForOrdering`, an Integer parameter with a runtime fallback and a range constraint. #### Documentation generation Adds a compile-time generator for descriptor-backed rows in the query context and Scan query documentation. - Normal Maven builds use `verify` mode. The generator renders complete document copies under `processing/target/generated-docs`, compares them with the checked-in Markdown, and fails the build if a generated row is stale. It does not modify source documentation in this mode. - Running Maven with `-Dquery.context.docs.mode=generate` updates the checked-in Markdown. The generator replaces only lines ending in an exact `GENERATED QUERY CONTEXT PARAMETER` marker. This currently covers the `useResultLevelCache` row in `query-context-reference.md` and the `maxRowsQueuedForOrdering` row in `scan-query.md`. - All other document lines are retained. Because generate mode rewrites each affected source file, it also normalizes line endings to `\n`. #### SQL `SET` integration hook Connects `SqlQueryPlus` to catalog validation. This validates recognized, migrated parameters and intentionally accepts all others. It demonstrates the future validation flow without claiming complete `SET` validation. #### System Table Integration -- 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]
