Druid OR filters should not discard matching timestamp ranges - #5243
Draft
bvolpato wants to merge 1 commit into
Draft
Druid OR filters should not discard matching timestamp ranges#5243bvolpato wants to merge 1 commit into
bvolpato wants to merge 1 commit into
Conversation
bvolpato
force-pushed
the
bvolpato/fix-druid-or-intervals
branch
from
September 4, 2026 16:40
5a10772 to
c1603bb
Compare
|
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.



Jira Link
Pending issue creation and linkage. This PR is a draft.
Changes Proposed
Druid interval extraction currently ignores OR branches it cannot represent as timestamp intervals. The filter rule then treats the remaining partial intervals as the complete condition and removes the filter, excluding valid rows.
Abort interval extraction if any OR branch is unrepresentable. This lets the existing filter path retain the full predicate. Add regressions for both operand orders, an empty-range branch, and planner behavior that preserves the original intervals and filter.
Reproduction
For a Druid table whose time column is
timestamp, this predicate must retain a row dated2021-01-15:The affected plan restricts intervals to dates before 2020 and drops the filter.
Validation
./gradlew autostyleApplyandgit diff --checkpass.mainwas blocked byjava.io.IOException: No space left on device; the full Gradle build has not been validated locally.Downsides
Mixed OR predicates may scan a wider interval and rely on Druid filtering. Narrowing the interval safely requires accounting for every disjunct.