refactor!: migrate SQL query context parameters #20578
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.69) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.69 · 446 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.365
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.069
Real PR Conversation Timeline
1 comments
"Review active on #20578"
general
weight: 0.35
GWphua
Description
Follow-up to #20555.
Migrates the SQL query context parameters documented in
sql-query-context.mdto typedQueryContextParameterdescriptors.QueryContextParameters. Field names follow the keys, e.g.plannerStrategy→PLANNER_STRATEGY,inSubQueryThreshold→IN_SUB_QUERY_THRESHOLD.PlannerContext,PlannerConfig, the planner rules, MSQ and Dart with descriptor-backed reads.-
sql-query-context.md, which gainsengine,executionMode,catalogValidationEnabled,fullReportandsqlJoinAlgorithm, and now holdssqlPlannerBloat, moved fromquery-context-reference.md.-
query-context-reference.md:noProjections,forceProjections,useProjection,useNestedForUnknownTypeInSubquery,numRetriesOnMissingSegments,returnPartialResultsanduncoveredIntervalsLimit.-
sqlJoinAlgorithmis also generated inmulti-stage-query/reference.mdanddart.md, replacing their hand-written rows.QueryContexts.PlannerStrategy(COUPLED,DECOUPLED) and makesplannerStrategyan enum parameter.Visibility.INTERNALlevel added in #20555 toSYSTEM, which says more plainly that Druid sets these values itself.Visibilityhas 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 matchingQueryContextskeys,QueryContexts.NATIVE_QUERY_SQL_PLANNING_MODE_COUPLED/DECOUPLED, andBaseQuery.QUERY_ID/SUB_QUERY_ID/SQL_QUERY_ID.Behavior changes
plannerStrategyanddruid.sql.planner.nativeQuerySqlPlanningModeaccept values in any case, e.g.decoupled. An unknown value is now rejected instead of silently falling back toCOUPLED. This includes an emptydruid.sql.planner.nativeQuerySqlPlanningMode=, which now fails at startup.maxNumericInFilters,sqlReverseLookupThreshold,sqlPlannerBloat,sqlOuterLimit,maxPlanningTimeMs,inSubQueryThreshold,inFunctionThreshold,inFunctionExprThreshold,uncoveredIntervalsLimit,numRetriesOnMissingSegments,defaultTimeout) reject values that aren't exact integers, such as1.5, and values out of range, instead of truncating them, as in #20555. This applies to native queries as well as SQL.PlannerContextused one generated ID for the planner and a different one in the context when nosqlQueryIdwas given. It now uses the same ID.This PR and #20579 both touch
QueryContextParametersandQueryContexts; whichever merges second will be rebased.<hr>
This PR has: