Repository navigation
filter by prefix_between/prefix_in in Reader - #14893
Merged
Merged
Conversation
aunjgr
requested review from
LeftHandCold,
XuPeng-SH,
m-schen,
nnsgmsone and
triump2020
as code owners
March 11, 2024 09:16
nnsgmsone
approved these changes
Mar 11, 2024
LeftHandCold
approved these changes
Mar 11, 2024
XuPeng-SH
approved these changes
Mar 12, 2024
m-schen
approved these changes
Mar 13, 2024
aunjgr
added a commit
to aunjgr/matrixone
that referenced
this pull request
Apr 10, 2024
to avoid copying entire block out of cache Approved by: @nnsgmsone, @LeftHandCold, @XuPeng-SH, @m-schen
fengttt
pushed a commit
to fengttt/matrixone
that referenced
this pull request
May 7, 2026
to avoid copying entire block out of cache Approved by: @nnsgmsone, @LeftHandCold, @XuPeng-SH, @m-schen
This was referenced Oct 6, 2026
Closed
mergify Bot
pushed a commit
that referenced
this pull request
Oct 6, 2026
Persisted, sorted secondary-index filtering can receive reversed Prepared BETWEEN bounds. `CollectOffsetsByPrefixBetweenFactory` searches the lower and upper positions independently, but only rejects `start == end`. When the upper position precedes the lower position, `make([]int64, end-start)` panics and a valid SELECT returns Error 20101 instead of an empty result. Reject `start >= end` before allocation. This is the same empty-selection invariant already used by the neighboring prefix-range helper. Keep both existing search comparisons unchanged: rejecting bytewise reversed bounds before searching would incorrectly discard valid shorter-upper-prefix ranges. Normal nonempty selections retain the same searches, allocation and offsets. No planner, parameter conversion, index format, cache or distributed execution change is included. Extend the existing six-key unit fixture with forward/equal/short-upper-prefix, reversed, missing and empty-vector cases, checking explicit expected offsets and the existing linear helper. Add a self-contained 256-row persisted-index BVT for reused and fresh SQL PREPARE handles, equal/overlapping/NULL bindings, a mixed empty/nonempty OR, and literal/no-secondary-index controls. This is a longstanding component boundary defect, not a proven recent regression: the missing guard exists in #14893 (March 2024), and the actual SQL panic also reproduces on the September 30, 2026 4.2 image `28f1f02`. MOTR #215 added the reversed-bound probe on October 5. The earliest release where this exact SQL plan became reachable has not been bisected. Tested with: - Fresh Main base `c65991043b10fb39988d45b72af1485560ac5433` plus this patch; matching native artifacts built locally and on the isolated Linux test host. - `.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=120s -run '^TestCollectOffsetsByPrefixBetweenFactory$' ./pkg/container/vector`: the added reversed case panics without the production fix; all 13 subtests pass with it, both on macOS arm64 and Linux amd64. - Complete `./pkg/container/vector` tests pass on both platforms; complete `./pkg/objectio` tests and `go vet ./pkg/container/vector ./pkg/objectio` pass locally with matching CGo settings. - The original real binary-protocol `int64` probe on a 32,768-row persisted secondary-index fixture: all nine result checks match an independent finite-domain oracle on the fixed Main binary. Includes forward, reversed, NULL, out-of-INT32, rebind/recovery, SQL PREPARE, literal and no-index cases. - Official mo-tester normal comparison (not result recording) on the isolated host: the new BVT fails on exactly three queries on the incident Main image; fixed Main passes **37/37 statements twice on the same instance**, with zero ignored/abnormal statements and zero BVT database residue after each run. - SQL remains usable after the protocol probe and first BVT. The owned test container remained running without OOM and exited 0 after deliberate stop. - Complete self-review and `git diff --check`: no unresolved blockers. Valid ranges gain no additional scan, allocation, copy, synchronization or I/O. This PR targets Main only. Unrelated Prepared performance/type-normalization failures in #29606 are not claimed to be fixed. Approved by: @XuPeng-SH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
issue https://github.com/matrixorigin/MO-Cloud/issues/2574
What this PR does / why we need it:
to avoid copying entire block out of cache