Repository navigation
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? |
|
Final first-principles follow-up at f934a5b. Design / scope
Correctness and unhappy paths
Non-spill cost
Real MatrixOne harness on 10.222.1.55
Validation / review state
@aunjgr @gouhongshen @heni02 @aptend @LeftHandCold please re-review the complete final head. |
|
Conflict resolution pushed at 19dbe7f, merging current main ecc389d. The real semantic conflict was protocol allocation, not just generated-code text: main now owns v7 for structured CHECK constraints, while this PR had previously allocated v7 to the exact runtime-filter contract. The resolution preserves main v7, assigns the exact runtime-filter contract to v8, and makes MORPCLatestVersion v8. All exact-filter gates/tests moved to v8; CHECK remains gated at v7. I also strengthened the boundary regression: a CHECK-capable v7 service must still suppress metadata-dependent exact runtime filters, while v8 enables them; lowering v8 back to v7 suppresses them again and invalidates cached/prepared plans. Both conflicting generated files were regenerated from the cleanly merged proto sources. The result simultaneously preserves upstream CheckDef.origin_sql and removed-field reservations for SOURCE_SCAN, stream_scan, and SHOW_CONNECTORS, plus this PR's FuzzyFilter runtime-filter field, RuntimeFilterSpec tags 7-10, and FuzzyBuildSide tag 76. No removed source/stream operator symbol remains. Per request, I did not rerun the heavy spill harness, race suite, or full packages. The spill admission/re-spill/cleanup implementation is unchanged from f934a5b. Lightweight targeted checks passed:
GitHub now reports the PR MERGEABLE; it is BLOCKED only by the restarted checks/reviews, not by conflicts. @aunjgr @gouhongshen @heni02 @aptend @LeftHandCold please re-review the conflict-resolution head. |
LeftHandCold
left a comment
There was a problem hiding this comment.
Deep re-review completed at 19dbe7f. APPROVED; no production-reachable blocking findings.
The latest spill changes preserve row conservation and ownership across the resident-to-spill transition and recursive rebuild: the threshold-crossing input is spilled before retention, retained/pending/unread batches are consumed exactly once, and map-admission recovery is allowed only while HashmapBuilder proves that Dedup has not destructively rewritten its input. Scratch, memory, spill-disk, FD, expression, file, and JoinMap ownership all terminate on success, cancellation, error, Reset/Free, and re-spill paths; recursion and queue growth remain bounded. The resident path adds only constant-time threshold/accounting work and does not pre-admit spill scratch.
The merge with current main also resolves the real protocol collision correctly: structured CHECK remains on MORPC v7, the versioned exact runtime-filter contract advances to v8, all production planner gates use v8, and v7 rollback fails open. Protobuf tags are append-only and preserve both main and PR fields/removals; plan/prepared-plan cache invalidation covers v7 to v8 and v8 to v7.
Focused low-concurrency tests passed for the three new HashBuild threshold/lazy-admission cases, eight rebuild/re-spill headroom, conservation, lifecycle, and Dedup safety cases, and the v7/v8 runtime-filter planner boundary. git diff --check is clean. Current-head CI has no reported failure; UT, coverage, SCA, BVT, and connector jobs are still running and remain merge gates.
Keep speculative spill sizing and reservation off the resident hash-build path. Admit actual scratch lazily when spill starts, expose scratch diagnostics, and convert terminal budget admissions into actionable resource errors without changing internal recovery control flow.
Avoid telling users to make a join spill-eligible when an eligible shuffle join can still reject an oversized per-batch scratch request. Point to build width, query memory, the process limit, and the actual eligibility boundary.
Apply the existing spill threshold to retained state plus the current input before copying it. This preserves lazy scratch admission and the resident fast path while keeping enough budget headroom for autonomous spill recovery.
What type of PR is this?
Which issue(s) this PR fixes
Related to #26432. This is an incremental typed-key/spill contract PR and intentionally does not close the entire issue.
Why
Spill is not a second equality implementation. If scalar SQL says two join keys are equal, resident join, initial spill, probe partitioning, recursive re-spill, and any pre-join runtime filter must preserve that match.
Two correctness gaps violated that rule:
Scaled
FLOAT32scalar comparison normalizes each operand to its declared scale, but resident hash keys and spill partition keys previously used raw IEEE-754 bytes. SQL-equal values could land in different hash groups/buckets.An exact runtime filter is optional but may run before the join in scans, zonemaps, and Bloom filters. Those consumers compare encoded payloads, not the final join equality. A stale or under-specified plan could therefore silently remove a row that the join itself would match. The concrete stale-plan shape is:
SQL
=is true, while old rawINcompares100 != 1000.What this PR changes
One typed-key contract for resident and spill
Float32ScaleNormalizeris shared by scalar comparison and key encoding.Float32Codecsupplies the canonical resident/spill key and closes+0/-0.IntHashMap, compositeStrHashMap, initial build spill, probe partitioning, and recursive re-spill.Exact runtime filters are versioned, selective, and fail open
The planner and all producers now share an explicit contract:
RuntimeFilterKeyEncodingis an explicit versioned marker. Default, legacy, unknown, contradictory, or incomplete metadata publishesPASS.RuntimeFilterSpeccarries the probe type, producer expression, and ordered component probe types for tuple encodings.PASS.FLOAT64and unscaledFLOAT32exact filters remain enabled. If zero exists, the payload contains both physical+0and-0, so raw Bloom consumers cannot reject a SQL-equal zero.FLOAT32remainsPASSfor exact raw filters: its rounded SQL equivalence class cannot be represented by the current rawIN/zonemap/Bloom payload without false negatives.PASSno longer creates optimistic side effects.This is selective conservatism, not a blanket FLOAT runtime-filter disable.
Spill/runtime-filter memory and unhappy paths
UnionBatch, reallocation overlap, tuple packer classes, scratch memory, and message-owned wire payloads.PASS; mandatory hash-map construction continues.chunks × retained-batchesscans.NaN scope is deliberately narrow
This PR does not define NaN join equality and does not redesign every zonemap predicate.
INpruning chain (AnyGEByValue,AnyLEByValue,SubVecIn,AnyIn).AnyIn/SubVecInuses the same total-order comparator as sorting.This is the minimum compatibility fix needed to prevent a poisoned legacy bound from silently hiding an ordinary matching value.
Contract status
Every active equality case uses the real scalar
=evaluator as the oracle.DOUBLE +0 / -0TRUEFLOAT32 +0 / -0TRUEFLOAT32equal after declared-scale normalizationTRUEPASSFLOAT32values that normalize differentlyFALSEPASSDECIMALTRUEDECIMALcontractTRUEPASSNULL / NULLNULLJSON 1 / 1.0TRUEVECF32 +0 / -0TRUENaN / NaNjoin semanticsFALSEThe regular planner still restricts remote shuffle join keys to its existing type set. This PR does not silently enable remote FLOAT shuffle.
Test plan
The regression is small, deterministic operator execution. It does not require large BVT data or an embedded-cluster SQL fixture.
Resident / initial spill / re-spill
FLOAT32inputs through all three physical modes.Runtime-filter correctness and rollout
=is true, old rawINis false, and the new producer publishesPASS.PASS.Budget, liveness, and recovery
NaN compatibility
[NaN, 7]and[7, NaN]build[7, 7].IN.Local validation after merging latest main
All tests use
.agents/skills/mo-dev/scripts/mo-cgo-test.-racepassed for runtimefilter, HashBuild, IndexBuild, FuzzyFilter, and spillutil.-count=10.gap_fill_mode=75is preserved and the not-yet-releasedfuzzy_build_sidemoved to 76.Performance
No measurable non-spill regression was found.
Alternating precompiled A/B runs used one core, five paired one-second samples, and compared the same workloads before/after the runtime-filter/budget changes:
-0.02%+0.88%-0.03%+0.38%bytes/opandallocs/opwere exactly unchanged:560 B/op,8 allocs/op10,376 B/op,24 allocs/op24,152 B/op,539 allocs/opFloat zonemap update at 10k rows measured
+0.53%for FLOAT32 and-1.27%for FLOAT64, with unchanged allocation; both are within observed noise.Why the hot path remains stable:
The intentional tradeoff is pruning, not join execution: scaled
FLOAT32or an unprovable stale contract may scan more rows because the optional exact filter publishesPASS. Correct matches are preserved, and safe float/integer/string filters remain enabled.