Repository navigation
fix(join): complete typed-key semantics for #26432 - #26738
Conversation
Complete the remaining #26432 join-key semantics across resident and spill paths: normalize exact JSON numeric forms and VECF32 signed zero, and make FLOAT NaNs non-matching in join maps. Cover HashJoin, DedupJoin, RightDedupJoin, MARK joins, and serialized maps.
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? |
|
Self-review conclusion at ce47cd1: REQUEST CHANGES.\n\nGitHub does not allow the PR author to submit a formal REQUEST_CHANGES review on the same PR, so this comment records the decision and its blockers.\n\n1. JSON key equality is still not closed over the actual SQL numeric domain. Scalar comparison treats TpCodeDecimal as numeric and compares it exactly with INT64, UINT64, and FLOAT64, but canonicalByteJSONSize and appendCanonicalJSONNumeric only handle the latter three. CAST(decimal AS JSON) is a normal producer of TpCodeDecimal, so scalar equality can be TRUE while resident and spill keys differ. The same hole exists recursively in arrays and objects.\n\n2. VECF32 semantics remain representation-dependent. For inline short vectors, equalFn takes compareVarlenaEqual and compares raw bytes, so +0 and -0 yield FALSE; AppendCanonicalVecF32 canonicalizes every length, so the hash join matches them. A direct resident counterexample produced 129 matches where the scalar oracle expected none. The existing HashJoin oracle uses an 8-element vector, which forces the area path; the new short-vector DedupJoin and RightDedupJoin tests are not oracle-backed and therefore hide this mismatch.\n\n3. More fundamentally, current JSON INT/UINT versus FLOAT comparison uses a 1e-8 tolerance while FLOAT versus FLOAT is exact. Equality is non-transitive: 1 equals 1.000000001, and 1 equals 1.0, but 1.000000001 does not equal 1.0. No hash canonicalization can exactly represent a non-equivalence relation.\n\nPlease first define one transitive JSON numeric equality domain, use it in both scalar comparison and the typed-key codec including TpCodeDecimal recursively, and make inline/area VECF32 scalar comparison identical. Then add nested-loop differential cases for decimal root/nested JSON, near-integer JSON, and both inline and area VECF32.\n\nI pushed test-only commit ce47cd1. It covers JSON numeric boundaries, const/flat/null/start-offset/grouping shapes, resident canonical varlena keys, and spill partition hashing. Replaying the official coverage parser against the prior CI profiles plus these tests gives 199/226 changed blocks, 88.05%, above the 75% gate. This coverage improvement does not resolve the semantic blockers above. |
|
Systematic fix is now pushed in f80f701. Self-review conclusion: APPROVE. The previous blockers are closed at the equality-contract layer, not patched per operator:
Validation:
I did not wait for the restarted CI. |
aunjgr
left a comment
There was a problem hiding this comment.
Reviewed exact head f80f701. I checked the typed-key equality changes across resident maps, serialized spill/re-spill maps, JSON numeric canonicalization, signed-zero vector keys, NaN rejection, and NULL/MARK semantics. The key-size/encoding paths remain aligned and I found no blocking correctness or lifecycle issue. All required checks are green.
|
Tick the box to add this pull request to the merge queue (same as
|
## What changed - accept non-empty constant vectors as logical broadcasts in spill and re-spill row-shape validation - project constant varlena recovery memory from logical row ranges instead of physical vector length - keep nil, empty constants with non-empty input, and ordinary short vectors fail-closed - add prepared-parameter initial-spill, re-spill materialization, recovery-offset, and shape-control regressions ## Why The typed-key work in #26738 made resident and spill hashing share one codec. After #26836, resident hash maps also accept a physical-length-one constant vector over an arbitrary logical row range, while spill validation still required `vec.Length() == rows`. A prepared parameter therefore worked in resident mode but failed initial spill or re-spill with `ErrHashBuildBudgetInvalid`. This change aligns the existing spill boundary with the vector broadcast contract. It does not change typed-key encoding or add a new abstraction. ## Validation The new focused tests failed on the unfixed `main` with `invalid hash build budget` and pass after the change. - `go list`, `go build`, and `go vet` for `keycodec`, `hashbuild`, and `spillutil` - full tests for all three owning packages - focused HashJoin, DedupJoin, and RightDedupJoin typed-key contract suites across resident, initial spill, and re-spill modes ## Performance The ordinary spill path adds one inlinable `IsConst` branch per vector per batch. There are no new per-row operations, allocations, copies, logs, locks, or retained state. Closes #26432 --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…xorigin#26738) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#26432 ## What this PR does / why we need it: Completes the three remaining typed-key equality semantics in matrixorigin#26432, consistently for resident maps and spill/re-spill rebuilds, without introducing a broad codec framework. - Canonicalizes exact JSON numeric forms (`1`, `1.0`, `1e0`) recursively and normalizes VECF32 signed-zero elements. - Makes FLOAT32/FLOAT64 NaNs non-matching only for join maps, preserves MARK join FALSE versus NULL semantics, and persists this key-domain policy through map serialization. - Adds HashJoin, DedupJoin, and RightDedupJoin coverage for resident, initial-spill, and re-spill modes, serialized maps, and repeated NaN probes. Validation: - [x] The newly enabled regressions fail on the pre-fix main baseline. - [x] `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/common/hashmap/keycodec ./pkg/common/hashmap ./pkg/sql/colexec/hashbuild ./pkg/sql/colexec/hashjoin ./pkg/sql/colexec/dedupjoin ./pkg/sql/colexec/rightdedupjoin -count=1` - [x] Built and vetted all six affected packages with the controlled CGo environment. - [x] Repeated single-core HashBuild benchmarks: INT64, inline VARCHAR, and 128-byte VARCHAR median deltas were +0.9%, +0.8%, and +1.6%; allocations unchanged. Self-review: - No new goroutines, locks, channels, waits, or lifecycle ownership changes; race-stress gate is not applicable. - Reviewed resident and serialized-map/rebuild closures, NULL/MARK behavior, key-size bounds, and common non-float/non-canonical hot paths.
…6938) ## What changed - accept non-empty constant vectors as logical broadcasts in spill and re-spill row-shape validation - project constant varlena recovery memory from logical row ranges instead of physical vector length - keep nil, empty constants with non-empty input, and ordinary short vectors fail-closed - add prepared-parameter initial-spill, re-spill materialization, recovery-offset, and shape-control regressions ## Why The typed-key work in matrixorigin#26738 made resident and spill hashing share one codec. After matrixorigin#26836, resident hash maps also accept a physical-length-one constant vector over an arbitrary logical row range, while spill validation still required `vec.Length() == rows`. A prepared parameter therefore worked in resident mode but failed initial spill or re-spill with `ErrHashBuildBudgetInvalid`. This change aligns the existing spill boundary with the vector broadcast contract. It does not change typed-key encoding or add a new abstraction. ## Validation The new focused tests failed on the unfixed `main` with `invalid hash build budget` and pass after the change. - `go list`, `go build`, and `go vet` for `keycodec`, `hashbuild`, and `spillutil` - full tests for all three owning packages - focused HashJoin, DedupJoin, and RightDedupJoin typed-key contract suites across resident, initial spill, and re-spill modes ## Performance The ordinary spill path adds one inlinable `IsConst` branch per vector per batch. There are no new per-row operations, allocations, copies, logs, locks, or retained state. Closes matrixorigin#26432 --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…xorigin#26738) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#26432 ## What this PR does / why we need it: Completes the three remaining typed-key equality semantics in matrixorigin#26432, consistently for resident maps and spill/re-spill rebuilds, without introducing a broad codec framework. - Canonicalizes exact JSON numeric forms (`1`, `1.0`, `1e0`) recursively and normalizes VECF32 signed-zero elements. - Makes FLOAT32/FLOAT64 NaNs non-matching only for join maps, preserves MARK join FALSE versus NULL semantics, and persists this key-domain policy through map serialization. - Adds HashJoin, DedupJoin, and RightDedupJoin coverage for resident, initial-spill, and re-spill modes, serialized maps, and repeated NaN probes. Validation: - [x] The newly enabled regressions fail on the pre-fix main baseline. - [x] `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/common/hashmap/keycodec ./pkg/common/hashmap ./pkg/sql/colexec/hashbuild ./pkg/sql/colexec/hashjoin ./pkg/sql/colexec/dedupjoin ./pkg/sql/colexec/rightdedupjoin -count=1` - [x] Built and vetted all six affected packages with the controlled CGo environment. - [x] Repeated single-core HashBuild benchmarks: INT64, inline VARCHAR, and 128-byte VARCHAR median deltas were +0.9%, +0.8%, and +1.6%; allocations unchanged. Self-review: - No new goroutines, locks, channels, waits, or lifecycle ownership changes; race-stress gate is not applicable. - Reviewed resident and serialized-map/rebuild closures, NULL/MARK behavior, key-size bounds, and common non-float/non-canonical hot paths.
…6938) ## What changed - accept non-empty constant vectors as logical broadcasts in spill and re-spill row-shape validation - project constant varlena recovery memory from logical row ranges instead of physical vector length - keep nil, empty constants with non-empty input, and ordinary short vectors fail-closed - add prepared-parameter initial-spill, re-spill materialization, recovery-offset, and shape-control regressions ## Why The typed-key work in matrixorigin#26738 made resident and spill hashing share one codec. After matrixorigin#26836, resident hash maps also accept a physical-length-one constant vector over an arbitrary logical row range, while spill validation still required `vec.Length() == rows`. A prepared parameter therefore worked in resident mode but failed initial spill or re-spill with `ErrHashBuildBudgetInvalid`. This change aligns the existing spill boundary with the vector broadcast contract. It does not change typed-key encoding or add a new abstraction. ## Validation The new focused tests failed on the unfixed `main` with `invalid hash build budget` and pass after the change. - `go list`, `go build`, and `go vet` for `keycodec`, `hashbuild`, and `spillutil` - full tests for all three owning packages - focused HashJoin, DedupJoin, and RightDedupJoin typed-key contract suites across resident, initial spill, and re-spill modes ## Performance The ordinary spill path adds one inlinable `IsConst` branch per vector per batch. There are no new per-row operations, allocations, copies, logs, locks, or retained state. Closes matrixorigin#26432 --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…xorigin#26738) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#26432 ## What this PR does / why we need it: Completes the three remaining typed-key equality semantics in matrixorigin#26432, consistently for resident maps and spill/re-spill rebuilds, without introducing a broad codec framework. - Canonicalizes exact JSON numeric forms (`1`, `1.0`, `1e0`) recursively and normalizes VECF32 signed-zero elements. - Makes FLOAT32/FLOAT64 NaNs non-matching only for join maps, preserves MARK join FALSE versus NULL semantics, and persists this key-domain policy through map serialization. - Adds HashJoin, DedupJoin, and RightDedupJoin coverage for resident, initial-spill, and re-spill modes, serialized maps, and repeated NaN probes. Validation: - [x] The newly enabled regressions fail on the pre-fix main baseline. - [x] `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/common/hashmap/keycodec ./pkg/common/hashmap ./pkg/sql/colexec/hashbuild ./pkg/sql/colexec/hashjoin ./pkg/sql/colexec/dedupjoin ./pkg/sql/colexec/rightdedupjoin -count=1` - [x] Built and vetted all six affected packages with the controlled CGo environment. - [x] Repeated single-core HashBuild benchmarks: INT64, inline VARCHAR, and 128-byte VARCHAR median deltas were +0.9%, +0.8%, and +1.6%; allocations unchanged. Self-review: - No new goroutines, locks, channels, waits, or lifecycle ownership changes; race-stress gate is not applicable. - Reviewed resident and serialized-map/rebuild closures, NULL/MARK behavior, key-size bounds, and common non-float/non-canonical hot paths.
…6938) ## What changed - accept non-empty constant vectors as logical broadcasts in spill and re-spill row-shape validation - project constant varlena recovery memory from logical row ranges instead of physical vector length - keep nil, empty constants with non-empty input, and ordinary short vectors fail-closed - add prepared-parameter initial-spill, re-spill materialization, recovery-offset, and shape-control regressions ## Why The typed-key work in matrixorigin#26738 made resident and spill hashing share one codec. After matrixorigin#26836, resident hash maps also accept a physical-length-one constant vector over an arbitrary logical row range, while spill validation still required `vec.Length() == rows`. A prepared parameter therefore worked in resident mode but failed initial spill or re-spill with `ErrHashBuildBudgetInvalid`. This change aligns the existing spill boundary with the vector broadcast contract. It does not change typed-key encoding or add a new abstraction. ## Validation The new focused tests failed on the unfixed `main` with `invalid hash build budget` and pass after the change. - `go list`, `go build`, and `go vet` for `keycodec`, `hashbuild`, and `spillutil` - full tests for all three owning packages - focused HashJoin, DedupJoin, and RightDedupJoin typed-key contract suites across resident, initial spill, and re-spill modes ## Performance The ordinary spill path adds one inlinable `IsConst` branch per vector per batch. There are no new per-row operations, allocations, copies, logs, locks, or retained state. Closes matrixorigin#26432 --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #26432
What this PR does / why we need it:
Completes the three remaining typed-key equality semantics in #26432, consistently for resident maps and spill/re-spill rebuilds, without introducing a broad codec framework.
1,1.0,1e0) recursively and normalizes VECF32 signed-zero elements.Validation:
.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/common/hashmap/keycodec ./pkg/common/hashmap ./pkg/sql/colexec/hashbuild ./pkg/sql/colexec/hashjoin ./pkg/sql/colexec/dedupjoin ./pkg/sql/colexec/rightdedupjoin -count=1Self-review: