You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "FrankChen021 (via GitHub)" <gi...@apache.org> on 2026/10/14 06:52:17 UTC
[PR] refactor!: migrate SQL query context parameters (druid)
FrankChen021 opened a new pull request, #20578:
URL: https://github.com/apache/druid/pull/20578
### Description
Follow-up to #20555. Replaces #20556, which was closed while #20555 was under review.
Migrates the SQL query context parameters documented in `sql-query-context.md` to typed `QueryContextParameter` descriptors.
- Declares descriptors for SQL planner, MSQ and Dart parameters in `QueryContextParameters`. Field names follow the keys, e.g. `plannerStrategy` → `PLANNER_STRATEGY`, `inSubQueryThreshold` → `IN_SUB_QUERY_THRESHOLD`.
- Replaces raw-string reads in `PlannerContext`, `PlannerConfig`, the planner rules, MSQ and Dart with descriptor-backed reads.
- Generates the corresponding rows in `sql-query-context.md` from the descriptors.
- Adds `QueryContexts.PlannerStrategy` (`COUPLED`, `DECOUPLED`) and makes `plannerStrategy` an enum parameter.
- Renames the `Visibility.INTERNAL` level added in #20555 to `SYSTEM`, which says more plainly that Druid sets these values itself. `Visibility` has not been released yet.
Existing parameter names and defaults are unchanged.
#### Deprecations
The replaced key and default constants are kept as `@Deprecated(since = "39.0.0", forRemoval = true)` with a link to the descriptor: `PlannerContext.CTX_*`/`DEFAULT_*`, `PlannerContext.getJoinAlgorithm(...)`, `PlannerConfig.CTX_KEY_*`, `ReverseLookupRule.CTX_THRESHOLD`/`DEFAULT_THRESHOLD`, `CalciteRulesManager.BLOAT_PROPERTY`/`DEFAULT_BLOAT`, `SketchQueryContext.CTX_FINALIZE_OUTER_SKETCHES`/`DEFAULT_FINALIZE_OUTER_SKETCHES`, the matching `QueryContexts` keys, `QueryContexts.NATIVE_QUERY_SQL_PLANNING_MODE_COUPLED`/`DECOUPLED`, and `BaseQuery.QUERY_ID`/`SUB_QUERY_ID`/`SQL_QUERY_ID`.
#### Behavior changes
- `plannerStrategy` and `druid.sql.planner.nativeQuerySqlPlanningMode` accept values in any case, e.g. `decoupled`. An unknown value is now rejected instead of silently falling back to `COUPLED`.
- `PlannerConfig.getNativeQuerySqlPlanningMode()` and `PlannerConfig.Builder.nativeQuerySqlPlanningMode(...)` use `QueryContexts.PlannerStrategy` instead of `String`.
- Integer and long parameters (`maxNumericInFilters`, `sqlReverseLookupThreshold`, `sqlPlannerBloat`, `sqlOuterLimit`, `maxPlanningTimeMs`) reject values that aren't exact integers, such as `1.5`, and values out of range, instead of truncating them, as in #20555.
- `PlannerContext` used one generated ID for the planner and a different one in the context when no `sqlQueryId` was given. It now uses the same ID.
This PR and the remaining query context migration both touch `QueryContextParameters` and `QueryContexts`; whichever merges second will be rebased.
<hr>
This PR has:
- [x] been self-reviewed.
- [x] added documentation for new or modified features or behaviors.
- [x] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
- [x] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] refactor!: migrate SQL query context parameters (druid)
Posted by "FrankChen021 (via GitHub)" <gi...@apache.org>.
FrankChen021 merged PR #20578:
URL: https://github.com/apache/druid/pull/20578
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org