Repository navigation
test(cpp): cover time operator filters - #1119
Merged
ColinLeeo merged 2 commits intoNov 17, 2026
Merged
Conversation
Add unit tests for TimeBetween, TimeIn, TimeEq, TimeNotEq, TimeGt, TimeGtEq, TimeLt and TimeLtEq: statistic pruning, row-level predicates, range introspection and the SIMD/scalar batch paths. The tests exposed a precedence bug in TimeBetween::satisfy(): `^` binds tighter than `&&`, so NOT BETWEEN rejected timestamps below the lower bound instead of accepting everything outside the interval. Parenthesize the range test to match satisfy(Statistic*) and satisfy_start_end_time().
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The tests preserve incorrect TimeNotEq boundary pruning that causes chunk readers to drop valid rows; only the singleton range [3, 3] should be rejected for time != 3.
1 open issue
What changed in this PR
This PR expands coverage of C++ time-filter operators and fixes a NOT BETWEEN precedence error found by the new tests.
Changes:
- Add tests for eight operators covering pruning, row predicates, time ranges, boundary cases, and batch filtering.
- Parenthesize the range condition in both
TimeBetween::satisfyoverloads so negation applies to the whole interval.
| File | Description |
|---|---|
cpp/test/reader/filter/time_operator_test.cc |
Adds time-filter semantics and boundary tests. |
cpp/src/reader/filter/time_operator.cc |
Fixes NOT BETWEEN evaluation for numeric and string row predicates. |
Review effort: Balanced
TimeNotEq::satisfy_start_end_time() returned false whenever the excluded value matched either end of the block range. Chunk readers skip a block when it returns false, so `time != 3` dropped every row of a block starting or ending at 3. Only a single-point range can be fully excluded. Expect true for ranges that straddle the excluded value and add an end-to-end query regression that reads 299 of 300 rows.
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.

Summary
Add unit coverage for the time filter operators in
cpp/src/reader/filter/time_operator.cc, which sat at 48% line coverage with 33 functions never executed.cpp/test/reader/filter/time_operator_test.cccovers, forTimeBetween,TimeIn,TimeEq,TimeNotEq,TimeGt,TimeGtEq,TimeLtandTimeLtEq:satisfy(Statistic*))int64_tandStringvaluessatisfy_start_end_time/contain_start_end_timeget_time_ranges()includingINT64_MIN/INT64_MAXedges and inverted rangessatisfy_batch_timevia 6/5/0 element inputs, exercising both the vector width (NEON pairs / SSE-AVX2 quads) and the scalar tailis_unbounded_time_filter/is_contiguous_time_filtercontractsThe tests exposed a precedence bug in
TimeBetween::satisfy(int64_t, int64_t/String):^binds tighter than&&, soNOT BETWEENrejected timestamps below the lower bound instead of accepting everything outside the interval (contradictingsatisfy(Statistic*),satisfy_start_end_time()and the documented inverted-range behavior). The range test is now parenthesized.Coverage of
time_operator.cc: 48.2% -> 96.0% lines (315/328), 71/71 functions.Test plan
./mvnw -B clean verify -P with-java,with-python -Denable.lzma2=ON(Java, C++, Python; 1652 C++ tests passed)./mvnw -B clean verify -P with-cpp -Denable.asan=ON -Dbuild.type=RelWithDebInfo -Denable.lzma2=ON(1653 tests, 0 failed; macOS run used the Xcode 26.6 toolchain withASAN_OPTIONS=detect_container_overflow=0for the uninstrumented ANTLR runtime)./mvnw spotless:check -P with-java,with-python