Skip to content

fix(cpp): correct NOT BETWEEN page-statistic pruning - #1150

Merged
ColinLeeo merged 1 commit into
apache:developfrom
ColinLeeo:fix-191-not-between
Nov 27, 2026
Merged

ColinLeeo merged 1 commit into
apache:developfrom
ColinLeeo:fix-191-not-between

Conversation

@ColinLeeo

Copy link
Copy Markdown
Contributor

Summary

TimeBetween::satisfy(Statistic*) for a NOT BETWEEN filter only kept a page when it lay entirely outside [value1_, value2_]:

return statistic->end_time_ < value1_ || statistic->start_time_ > value2_;

This silently skipped pages that partially overlap the excluded interval, even though they still contain timestamps outside it (e.g. a page [2, 4] against NOT BETWEEN [3, 5] contains 2, which matches). The result was dropped rows.

Fix

Align the statistic-level check with satisfy_start_end_time(), which already uses the correct "may contain an out-of-interval time" semantics:

return statistic->start_time_ < value1_ || statistic->end_time_ > value2_;

Test

Added TimeOperatorTest.TimeBetweenNotBetweenStatisticPartialOverlap covering partial-overlap ([2,4], [4,6], [2,6] → keep) and boundary/inside cases ([3,4], [3,3], [5,5], [3,5] → prune).

TimeBetween::satisfy(Statistic*) kept a NOT BETWEEN page only when it lay
entirely outside [value1_, value2_], so a page that partially overlapped the
excluded interval was silently skipped even though it still contained
out-of-interval times. Align the statistic-level check with
satisfy_start_end_time(): start_time_ < value1_ || end_time_ > value2_.

Add a regression test covering partial-overlap and boundary cases.
@ColinLeeo
ColinLeeo merged commit 405a13b into apache:develop Nov 27, 2026
49 checks passed
@ColinLeeo
ColinLeeo deleted the fix-191-not-between branch November 27, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant