-
Notifications
You must be signed in to change notification settings - Fork 616
Support > and != on the same field #3454
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
Conversation
public @Nullable List<Value> getNotInValues(FieldIndex fieldIndex) { | ||
List<Value> values = new ArrayList<>(); | ||
|
||
public @Nullable Collection<Value> getNotInValues(FieldIndex fieldIndex) { |
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.
This method now supports a == 1 && a != 2, which now correctly just returns a != 2 instead of the concatenation of both.
Value.newBuilder() | ||
.setArrayValue(ArrayValue.newBuilder().addValues(MIN_VALUE)) | ||
.build(); | ||
filterValue = Values.MIN_VALUE; |
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.
Not In and Not Equal use the same bound, which makes the comparison logic at the end of this method work as we do not want to compare to an array but to an actual minimum.
@@ -740,8 +740,10 @@ private boolean isInFilter(Target target, FieldPath fieldPath) { | |||
for (Filter filter : target.getFilters()) { | |||
if ((filter instanceof FieldFilter) && ((FieldFilter) filter).getField().equals(fieldPath)) { | |||
FieldFilter.Operator operator = ((FieldFilter) filter).getOperator(); | |||
return operator.equals(FieldFilter.Operator.IN) | |||
|| operator.equals(FieldFilter.Operator.NOT_IN); | |||
if (operator.equals(FieldFilter.Operator.IN) |
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.
A not-in filter does not have to appear on the first filter for a field. If there are multiple filters for the field path, not in can appear later.
@@ -41,16 +41,15 @@ | |||
public static final Value NULL_VALUE = | |||
Value.newBuilder().setNullValue(NullValue.NULL_VALUE).build(); | |||
public static final Value MIN_VALUE = NULL_VALUE; | |||
private static final Value MAX_VALUE_TYPE = Value.newBuilder().setStringValue("__max__").build(); |
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.
All changes in this file are to support correct ordering for MAX_VALUE.
Size Report 1Affected Products
Test Logs
Notes |
Coverage Report 1Affected Products
Test Logs
Notes |
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.
Thanks for the comments.
This adds the ability to use inequality and equality filters on the same field.