Repository navigation
Fix regexp timeout deadlines and numeric comparison/scaling boundaries - #29595
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of b5fec7bd0ee308d2b0c709c7f89492509836b185 against 5e965dece9ea15fa5d73c9e9615c59fbde651aaa.
Recommendation: REQUEST_CHANGES — one confirmed P2 performance regression, detailed inline. The blanket bounded-floating guard also disables native filtering for exact, in-range constants. The new counterexample and measurement invalidate the broad claim that safe representable peers retain native filtering.
Other reviewed closures:
- Comparison narrowing: admission remains with the existing binder/shared proof; decimal proof conversion matches the executor. Literal/expression peers, IN/BETWEEN, prepared rebinding and index-bound consumers were traced. No additional wrong-result finding was confirmed.
- Decimal64: signed scaling preserves the original input on failure, allowing existing widening consumers to work. Direct/widened division converge on sign-aware range validation and sign restoration; magnitude rounding avoids overflow. No new correctness blocker found in Add/Sub/Compare/Mul/Mod consumers.
- regexp2 backport: reviewed the actual pinned dependency patch, including immutable epoch, cached polling, restart/extension synchronization and test cleanup. One updater owns publication, lock waits have local release paths, and retained state stays constant. Existing timeout/admission protection is preserved. The approximately 17 ns extra deadline-construction cost is distinct from the bounded-FLOAT regression.
Implementation, tests and documentation were considered separately: repository production Go changes +84/-56, UT +202/-16, SQL/result BVT +64/-0, module metadata +4/-0, no documentation file changes. The dependency's two-file clock/test patch was also reviewed. Tests reuse lightweight planner fixtures and the existing BVT; arithmetic rounding uses an independent big.Int oracle. The missing nearby control is a safe bounded FLOAT constant, not more repetitions of unsafe cases.
Validation: reused exact-head, fingerprint-verified normal package, function/dependency race, focused clock stress, SQL BVT and static-check evidence. Newly executed a full planner/real expression-executor counterexample and three 200 ms benchmark samples per variant using 8,192 rows and a reused executor. Base planner semantics were overlaid from the exact base (only the renamed helper identifier adapted); production files/worktree remain unchanged. Baseline safe-boundary assertions pass; head introduces a column CAST while preserving the result. The inline benchmark is an expression-level cost measurement, not an end-to-end SQL latency claim.
Before this review, there were no human/technical review comments or inline threads; the sole comment was Qodo's paused-review notification. CI completion was not awaited. No subagents, merge or rebase were used.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of c8f1a2118e7e29b7d81337a5f341161e6931f703 against 5e965dece9ea15fa5d73c9e9615c59fbde651aaa.
Recommendation: REQUEST_CHANGES — one confirmed P2 performance regression, detailed inline. The original FLOAT(4,1) c = 1 comment is fixed; a nearby safe DOUBLE-expression peer still retains the per-row column CAST. This is new evidence, not a reopening of the fixed literal case.
Design and closure review:
- Comparison proof belongs to the existing binder/shared admission path. Reusing the actual executor conversion, CAST rounding primitive and constant folder is the right direction; no second execution engine or persistent state is needed. Decimal collision/rounding, FLOAT32 exactness, bounded scale/range, ordinary DECIMAL coercion, IN/BETWEEN and prepared rebinding were traced. No additional wrong-result finding was confirmed. The remaining gap is the early folder's integer/decimal-only type whitelist.
- Decimal64 scaling preserves the original operand on overflow so existing widening consumers remain valid. Direct/widened division share sign/range handling, and magnitude rounding avoids overflowing the remainder. Add/Sub/Compare/Mul/Mod consumer paths were checked.
- The actual pinned regexp2 v1 backport was inspected, not just go.mod. Its immutable monotonic epoch supplies deadline creation while cached polling stays atomic. Q1: the existing updater owns publication and exits at the retained horizon; Q2: horizon/restart synchronization has local unlock paths, with expiry bounded under scheduler progress; Q3: state stays constant-size, without per-match timers or queues. Existing MO match/evaluation budgets and release ownership remain unchanged. Stalled publication, restart, concurrent extension and maximum finite-duration cases were considered. No new clock blocker was confirmed.
- No stored-data, catalog or wire format is changed. The bounded FLOAT BETWEEN expectation is the recorded ordinary-DECIMAL coercion choice, with scientific/explicit DOUBLE controls; it is not being interpreted as universal equivalence to two independent comparisons. No new compatibility branch is requested.
Implementation, tests and docs were assessed separately: production Go +202/-69; Go tests +240/-16; SQL/result BVT +123/-0; module metadata +4/-0; no documentation file changes. The dependency's clock/test patch was also inspected. Lightweight existing fixtures and the independent big.Int arithmetic oracle are appropriate. The missing orthogonal cell is safe floating-result expression versus safe literal/integer-result expression, not more copies of unsafe cases.
New local validation (Go 1.26.4, darwin/arm64, exact-head native artifacts):
- Full pkg/container/types, normal: PASS (1.690 s).
- Full pkg/sql/plan/function, normal: PASS (11.167 s).
- TestDecimalFloatOptimizedFilterResults, TestPreparedDecimalFloatFilterUsesUniqueValueProof and TestDecimalFloatComparisonUniqueValue, normal: PASS (3.073 s).
- Actual pinned regexp2 package, race: PASS (3.250 s).
- Independent parser -> full optimizer -> real filter executor probe: all six results correct, but three safe floating expressions retain a column CAST on head; the six base controls have no column CAST. Base control used an existing worktree whose planner/types/executor/vector/batch/mpool/native-source closures were verified identical to the exact base; it is not claimed to be a pristine full base checkout.
- Reused-executor benchmark, 8,192 rows, GOMAXPROCS=4, three 200 ms samples: the head's affected predicate costs ~2.13x its native literal control and allocates 96 B / batch. Separate base timings were noisier, so no precise base-to-head latency percentage is claimed.
The PR's reported full planner, SQL BVT/same-instance rerun and static checks were considered separately as author evidence; they were not all rerun here. CI is still running and was not awaited or called green. All human review threads were read; the sole prior technical thread is resolved and its literal fix was verified. Review work did not modify production/test sources or push anything, and no subagents were used.
This is a formal COMMENT with a REQUEST_CHANGES recommendation because the authenticated GitHub account is the PR author; it is not an APPROVE.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Post-fix deep review of 5d7fdce9aae77ab6f2beb47e8a7cc5898e4e5c4a against base/merge-base 5e965dece9ea15fa5d73c9e9615c59fbde651aaa.
Conclusion: no unresolved material blocker found in the reviewed scope. Both prior technical comments are substantively addressed, not merely marked resolved: safe bounded literals and safe floating-result expressions retain native column filtering. Unsafe peers still retain their guarded comparison domain.
Design and integration:
- Typed constant materialization and permission to narrow remain separate responsibilities. The existing executor-backed folder preserves source types and rejects dynamic/prepared/volatile provenance; the existing shared proof owns precision, scale/range and uniqueness. Keeping explicit DECIMAL64/128 checks avoids broadening to DECIMAL256. No second evaluator, cache, state machine or execution path was introduced.
- The bounded FLOAT proof shares CAST rounding/range arithmetic rather than maintaining a planner-only implementation. DECIMAL-to-DOUBLE uniqueness uses the actual executor conversion and neighboring coefficients. Comparison, membership, range and prepared consumers were reconciled.
- Decimal64 scaling checks signed bounds while preserving the operand on failure for widening consumers. Direct/widened division share sign/range handling; unsigned magnitude rounding avoids doubled-remainder overflow. No additional defect was confirmed in its arithmetic consumers.
- The pinned regexp2 dependency's clock owner was rechecked. Deadline creation uses the immutable monotonic epoch; polling remains atomic. Restart and horizon extension remain under the existing mutex.
Focused unhappy-path audit:
| Contract | Closure checked | Result |
|---|---|---|
| Q1 ownership | One clock updater; existing expression-executor cleanup and SQL connection/database fixture owners | No new leak/double-cleanup path found |
| Q2 termination | Updater unlocks while sleeping and exits after its retained horizon; speculative failures preserve original expressions; actual SQL error leaves session usable | Closed under normal scheduler progress |
| Q3 boundedness | Constant-size clock state; no per-match timer/queue; no persistent folding state | No new unbounded accumulation |
New adversarial validation was executed through the real SQL frontend on the exact head, using an uncommitted Go overlay and the existing fixture: PASS, 11.306 s. It adds 11 predicate/control cells for safe/unsafe NOT IN, NULL-bearing IN/NOT IN, NULL-safe equality, BETWEEN/NOT BETWEEN and an inactive invalid operand. It also verifies the documented NULL result for SQRT(-1), no matching rows when compared to that NULL, rejection of an actual out-of-range FLOAT(4,1) CAST, and same-session recovery afterward. The initial diagnostic incorrectly expected SQRT(-1) to raise a SQL error; source and the existing math BVT explicitly specify NULL, so that hypothesis was discarded and the error check replaced with the genuine range violation. This was not a product failure.
Semantically valid evidence reused rather than rerun: final full planner normal (6.629 s), full TestPreparedSpecializedDomains (10.336 s), six independent optimized-filter probes, final vet/incremental lint, unchanged types/function normal tests and pinned regexp2 race tests. The existing actual gpt-6.1-sol/xhigh exact-head overall review/reconciliation PASS was also retained as prior evidence; no new model/subagent review was launched in this turn.
Performance: the previously affected expression now has native filtering and 0 B/op / 0 allocs/op in all three benchmark samples, versus the former 96 B / one allocation. No fixed wall-time improvement is claimed from noisy timing samples. The clock's monotonic read is per deadline, not per VM polling step.
Engineering/test accounting across the complete PR: production Go +202/-69; Go unit/integration tests +317/-18; SQL/result BVT +123/-0; module metadata +4/-0; no tracked documentation changes. Tests reuse lightweight planner fixtures and the existing three-row public SQL fixture; arithmetic uses an independent big.Int oracle. No new heavy fixture, compatibility layer or obsolete parallel implementation was found necessary.
The ordinary-DECIMAL BETWEEN coercion change is an explicit behavior choice already documented with scientific/explicit DOUBLE controls; it is not presented as universal mixed-type SQL equivalence. No persisted format changes. Earlier six-file BVT evidence remains historical, not a claim that the entire set was rerun on this head. CI is still in progress and was not awaited or called green.
This turn changed no tracked sources and used no subagents or additional CLI model sessions. As the latest fix was authored in this workflow and the authenticated GitHub account is also the PR author, this is a formal COMMENT / no-blocker conclusion, not an independent GitHub APPROVE.
What type of PR is this?
Which issue(s) this PR fixes:
Closes #29592
Closes #29593
Closes #29594
What this PR does / why we need it:
A stale regexp2 clock publication can shorten a newly admitted match's timeout. Numeric comparison rewrites can discard the DOUBLE comparison domain and return wrong rows, while Decimal64 scaling can cross the signed coefficient boundary.
The constant folder supplies a typed value; it does not authorize narrowing. This separation avoids per-function patches, a second evaluator, or a new execution path. DECIMAL256 is not added to the folding whitelist.
One bounded-FLOAT BETWEEN expectation intentionally changes from 1 to 2 to apply established ordinary-DECIMAL coercion consistently to both bounds. Scientific and explicit DOUBLE controls still return 1. This is not a claim that arbitrary mixed-type BETWEEN equals two independent comparisons. No persisted format is changed.
Validation for final revision
5d7fdce9aae77ab6f2beb47e8a7cc5898e4e5c4a:TestPreparedSpecializedDomainsthrough the real SQL frontend: PASS (10.336 s), including safe/unsafe floating-expression results, EXPLAIN, NULL rows and prepared value rebinding. Reuses the existing three-row fixture and cleanup.go vetand incremental repository lint pass; lint reports 0 issues.gpt-6.1-sol / xhighdesign and overall final review: PASS, no unresolved material blocker. Design session01a10558-31e2-7820-89a5-32eedfabb6cd; final review/reconciliation session01a10565-d068-7291-9ea5-6bdbf96387b5reviewed the exact final revision. Final vet/lint process exit status was confirmed separately after the review snapshot.Performance: an 8,192-row reused-executor benchmark (three 200 ms samples, GOMAXPROCS=4) confirms zero steady-state Go allocations for the safe literal, integer expression and DOUBLE expression. The affected DOUBLE expression previously allocated 96 B / one allocation per batch. Timing samples were noisy, so no fixed cross-run or whole-query speedup is claimed. The unchanged regexp deadline-construction measurement is approximately 1.3 ns before / 18.7 ns after, with no allocations; VM polling remains atomic.
CI completion is not awaited or claimed green.