Repository navigation
Conversation
…nge filter ZM.Between() built a temporary zonemap without copying the scale from the source, causing CompareDecimal64WithScale to miscompare and prune blocks that actually contain matching rows. Also wires the in_range function into both CompileFilterExpr (zonemap pruning) and ConstructBasePKFilter (PK row filtering) so it benefits from the same block/object elimination as BETWEEN. Closes matrixorigin#24282 Co-Authored-By: Claude Opus 4.6 <[email protected]>
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
3 of 7 tasks
Contributor
Author
|
Absorbed into #24275 — the decimal zonemap fix and in_range wiring are now part of the secondary index range query PR. |
This branch was previously deployed
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 #24282
What this PR does / why we need it:
ZM.Between(lb, ub []byte)callsBuildZM(zm.GetType(), lb)to construct a temporary zonemap representing the query range, but never copies the scale from the source zonemap. When the type isDECIMAL(p,s), the subsequentIntersect()call usesCompareDecimal64WithScalewhich multiplies one operand by10^scale— but since the temp zonemap has scale=0, the comparison produces wrong results and prunes blocks that actually contain matching rows.Fix: add
oth.SetScale(zm.GetScale())afterBuildZM().Also wires
in_rangefunction intoCompileFilterExpr(zonemap pruning) andConstructBasePKFilter(PK row filtering) so it benefits from the same block/object elimination asBETWEEN.Verified:
go test ./pkg/vm/engine/tae/index/)DECIMAL(10,2) PK BETWEENon 20K-row table returns correct 5001 rows (was 0 before fix)in_range_operator.sqlBVT: 368/368 pass (was failing on DECIMAL cases)in_rangeflag variants (closed-closed, left-open, right-open, both-open) return correct counts