add native filters for "(filter) is true" and "(filter) is false"#15182
Merged
Conversation
changes: * add IsTrueDimFilter, IsFalseDimFilter, and abstract IsBooleanDimFilter for native json filter implementations of `(filter) IS TRUE` and `(filter) IS FALSE` * add IsBooleanFilter for actual filtering logic for these filters, which ignore includeUnknown to always use matches with false for true and !matches with true for false * fix test incorrectly adjusted to wrong answer in apache#15058
soumyava
reviewed
Oct 18, 2023
soumyava
left a comment
Contributor
There was a problem hiding this comment.
Took 1 pass, looks good to me so far. Will take another pass tomorrow
| ) | ||
| { | ||
| if (field == null) { | ||
| throw DruidException.forPersona(DruidException.Persona.USER) |
Contributor
There was a problem hiding this comment.
maybe replace with InvalidInput.exception()
| IsFalseDimFilter.of(new EqualityFilter("s0", ColumnType.STRING, "a", null)), | ||
| ImmutableList.of("0", "2", "4") | ||
| ); | ||
| // "(s0 = 'a') is not false", same rows as "s0 = 'a'", but also with null rows |
Contributor
There was a problem hiding this comment.
These comments are great !
| ); | ||
| } else if (kind == SqlKind.IS_FALSE || kind == SqlKind.IS_NOT_TRUE) { | ||
| if (NullHandling.useThreeValueLogic()) { | ||
| // use expression filter to get isfalse or nottrue expressions for correct 3vl behavior |
Contributor
There was a problem hiding this comment.
nit. isnottrue in place of nottrue
Member
Author
There was a problem hiding this comment.
ah, i was being consistent with the native expression names:
soumyava
approved these changes
Oct 18, 2023
soumyava
left a comment
Contributor
There was a problem hiding this comment.
Took a 2nd pass. Checked it out and ran some test cases around it with nullif. LGTM !
pranavbhole
approved these changes
Oct 18, 2023
clintropolis
added a commit
to clintropolis/druid
that referenced
this pull request
Oct 18, 2023
…ache#15182) * add native filters for "(filter) is true" and "(filter) is false" changes: * add IsTrueDimFilter, IsFalseDimFilter, and abstract IsBooleanDimFilter for native json filter implementations of `(filter) IS TRUE` and `(filter) IS FALSE` * add IsBooleanFilter for actual filtering logic for these filters, which ignore includeUnknown to always use matches with false for true and !matches with true for false * fix test incorrectly adjusted to wrong answer in apache#15058 * add tests for default value mode
LakshSingla
pushed a commit
that referenced
this pull request
Oct 19, 2023
…5182) (#15197) * add native filters for "(filter) is true" and "(filter) is false" changes: * add IsTrueDimFilter, IsFalseDimFilter, and abstract IsBooleanDimFilter for native json filter implementations of `(filter) IS TRUE` and `(filter) IS FALSE` * add IsBooleanFilter for actual filtering logic for these filters, which ignore includeUnknown to always use matches with false for true and !matches with true for false * fix test incorrectly adjusted to wrong answer in #15058 * add tests for default value mode
CaseyPan
pushed a commit
to CaseyPan/druid
that referenced
this pull request
Nov 17, 2023
…ache#15182) * add native filters for "(filter) is true" and "(filter) is false" changes: * add IsTrueDimFilter, IsFalseDimFilter, and abstract IsBooleanDimFilter for native json filter implementations of `(filter) IS TRUE` and `(filter) IS FALSE` * add IsBooleanFilter for actual filtering logic for these filters, which ignore includeUnknown to always use matches with false for true and !matches with true for false * fix test incorrectly adjusted to wrong answer in apache#15058 * add tests for default value mode
riovic918data
pushed a commit
to riovic918data/druid
that referenced
this pull request
Jun 12, 2026
…ache#15182) * add native filters for "(filter) is true" and "(filter) is false" changes: * add IsTrueDimFilter, IsFalseDimFilter, and abstract IsBooleanDimFilter for native json filter implementations of `(filter) IS TRUE` and `(filter) IS FALSE` * add IsBooleanFilter for actual filtering logic for these filters, which ignore includeUnknown to always use matches with false for true and !matches with true for false * fix test incorrectly adjusted to wrong answer in apache#15058 * add tests for default value mode
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.
Description
changes:
(filter) IS TRUEand(filter) IS FALSEThis PR has: