Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions cpp/src/reader/filter/time_operator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@ bool TimeBetween::satisfy(Statistic* statistic) {
}

bool TimeBetween::satisfy(int64_t time, int64_t value) {
return (value1_ <= time) && (time <= value2_) ^ not_;
// Parenthesize the range test: `^` binds tighter than `&&`, so without
// the inner parentheses NOT BETWEEN rejects times below value1_ instead
// of accepting every time outside the interval.
return ((value1_ <= time) && (time <= value2_)) ^ not_;
}

bool TimeBetween::satisfy(int64_t time, common::String value) {
return (value1_ <= time) && (time <= value2_) ^ not_;
return ((value1_ <= time) && (time <= value2_)) ^ not_;
}

bool TimeBetween::satisfy_start_end_time(int64_t start_time, int64_t end_time) {
Expand Down Expand Up @@ -230,7 +233,11 @@ bool TimeNotEq::satisfy(int64_t time, common::String value) {
}

bool TimeNotEq::satisfy_start_end_time(int64_t start_time, int64_t end_time) {
return value_ != end_time && value_ != start_time;
// "Could any time in [start, end] satisfy the filter?" Only a
// single-point range can be excluded completely; any wider range contains
// a timestamp different from value_, and chunk readers skip the whole
// block when this returns false.
return start_time != end_time || value_ != start_time;
}

bool TimeNotEq::contain_start_end_time(int64_t start_time, int64_t end_time) {
Expand Down
Loading
Loading