-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add native filters for "(filter) is true" and "(filter) is false" #15182
add native filters for "(filter) is true" and "(filter) is false" #15182
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took 1 pass, looks good to me so far. Will take another pass tomorrow
) | ||
{ | ||
if (field == null) { | ||
throw DruidException.forPersona(DruidException.Persona.USER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments are great !
return toSimpleLeafFilter( | ||
plannerContext, | ||
rowSignature, | ||
virtualColumnRegistry, | ||
Iterables.getOnlyElement(((RexCall) rexNode).getOperands()) | ||
); | ||
} 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. isnottrue in place of nottrue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, i was being consistent with the native expression names:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took a 2nd pass. Checked it out and ran some test cases around it with nullif. LGTM !
…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
…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
…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
Description
changes:
(filter) IS TRUE
and(filter) IS FALSE
This PR has: