Repository navigation
[4.2] Fix correlated scalar and grouped ENUM/SET conversions - #32841
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
This pull request is merged. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 61391b6066f0943566567d502ea55c7661dc7382
Assessment: request_changes
One reproduced regression remains: the new scalar stability guard rejects statement-stable NOW() subqueries. Otherwise, the implementation coherently reuses existing decorrelation, pagination, match-marker and ENUM/SET conversion owners.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
- P2
pkg/sql/plan/flatten_subquery.go:259: SELECT (SELECT NOW()) BETWEEN lo AND hi FROM time_bounds, with TIMESTAMP column bounds containing the current date.
Impact: Previously supported SQL now fails with error 20102. IsRealTimeRelated classifies statement-stable NOW() as varying, so BETWEEN's repeated scalar reference is rejected. Preserve statement-stable singleton results while retaining protection for genuinely varying expressions, and add regression coverage.
Evidence: statement-stable-candidate.jsonl records the failure; the identical probe using all eight merge-base production files passes and returns 1 in statement-stable-baseline.jsonl. The plain NOW() control passes on both. Receipts: checks/1794897334126048261-2.json (candidate exit 1) and checks/1794897384133579979-2.json (baseline exit 0). builtInCurrentTimestamp reads the fixed statement timestamp through proc.GetUnixTime().
Validation:
-
Full planner and function suites passed: owners-test.jsonl; receipt 1794896858838305524-2.json.
-
Rule and external consumer suites passed: consumer-test.jsonl; receipt 1794897046115346589-2.json.
-
go vet passed for all four packages: vet.log; receipt 1794897208782855858-2.json.
-
Single-CN SQL probes passed for grouped numeric and lexical behavior, NULLs, cardinality, repeated BETWEEN, prepared parameters and intended rejection paths: sql-contract.jsonl; receipt 1794897004734707540-2.json.
-
Candidate/baseline SQL comparison confirmed the NOW regression. Complete discussion coverage, command receipts, retained logs and source fingerprints were reconciled in validation-audit.json.
-
Isolation preflight, fresh native build, formatting and whitespace checks passed. Frozen source remains unchanged.
Limitations:
- Full distributed BVT and author-reported race/lint results were not independently verified; supplied local_validation contains no receipts. Live SQL validation used one CN.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 5265c9c46cdf9d7b0cc07fcc002081cf6655cd4c
Assessment: approve
No actionable defect remains. Expression-local reuse coherently uses existing join and conversion owners. The NOW regression identified in review 5934103316 is resolved.
Model: gpt-6.1-sol / max
Session: 01a1e395-a6d9-7ad1-bf20-81f1c6210100 · slot 2 · generation 0
Validation:
-
Current pkg/sql/plan suite passed with three unchanged unrelated skips; receipt checks/1794902854914201276-2.json.
-
Isolated single-CN SQL probe passed statement-stable bounds, prepared executions, scalar cardinality/empty-input and ENUM/SET numeric/lexical checks; receipt checks/1794903006332394103-2.json.
-
Reconciled prior same-PR function, rule/external and vet evidence for unchanged coverage; retained in reuse-audit.json.
-
Preflight, formatting, whitespace, native provenance and clean-head audits passed. validation-audit.json matches receipts and retained logs; discussion-assessment.json covers all five discussion items.
Limitations:
-
Runtime SQL validation used one CN. Distributed BVT, race and lint claims were not independently verified.
-
Supplied CI evidence was pending.
|
mo-bot review · Commit: PR closed or head changed |
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #32819
Related to #26030
Related to #28687
What this PR does / why we need it:
NOW()andCURRENT_DATE()remain reusable; repeated varying or conditional mixed-correlated shapes fail closed instead of duplicating evaluation or mutating a shared subquery plan.Validation on host 57 with Go 1.26.4:
pkg/sql/plannormal and race tests passed.pkg/sql/plan/function,pkg/sql/plan/rule, andpkg/sql/colexec/externalpassed.checkrecoverdiagnostics.gofmtandgit diff --checkpassed.Follow-up validation for statement-stable scalar reuse on macOS/arm64 with Go 1.26.4:
61391b6066for statement timestamp/date and nested timestamp reuse; the fix passes these cases while preserving rejection ofRAND(),SYSDATE()andRANDOM_BYTES().pkg/sql/plantests passed. The extended scalar correlated projection BVT passed 89/89 twice, covering column-bound TRUE/FALSE/NULL results and repeated prepared execution; teardown was verified after each run.Scope boundary: nested no-FROM scalar numeric arithmetic still reproduces on the base branch and is not covered by these fixes.