-
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
adding Upper/Lower Bound Filter #1936
Conversation
} | ||
return (input.compareTo(betweenDimFilter.getLower()) <= 0) && (input.compareTo(betweenDimFilter.getUpper()) | ||
>= 0); | ||
} |
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 is probably going to have very weird results for the age
use case e.g. this will say that age "100" is smaller than age "20" . I believe, you would need to at least support a flag saying whether the comparison should be done by converting string to numbers.
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.
@himanshug thanks, done
@himanshug / @b-slim how would you feel if the numeric condition just used the comparator from io.druid.query.topn.AlphaNumericTopNMetricSpec ? |
and possibly make it "alphaNumeric" instead of just numeric? |
@drcrallen @b-slim SGTM |
@drcrallen thanks, please check it out |
import java.io.IOException; | ||
import java.util.Arrays; | ||
|
||
public class BetweenDimFilterTests |
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.
Is it possible to test each of the return cases for isAlphaNumeric both true and false?
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.
@drcrallen done !
Is it possible to test the apply for the 8 cases? |
@b-slim would it make sense to add less than and greater than filters as well while we're at it? |
@xvrl i see how this can be useful, but i think we can have |
@xvrl did you mean adding more filters or updating the api for same filter? |
@@ -35,6 +35,7 @@ | |||
static final byte JAVASCRIPT_CACHE_ID = 0x7; | |||
static final byte SPATIAL_CACHE_ID = 0x8; | |||
static final byte IN_CACHE_ID = 0x9; | |||
public static byte BETWEEN_CACHE_ID = 0x10; |
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.
0xA
?
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.
done
1ea49e3
to
82ad49f
Compare
@himanshug and @xvrl please checkout this. |
@@ -151,6 +151,97 @@ The grammar for a IN filter is as follows: | |||
} | |||
``` | |||
|
|||
### Bound filter | |||
|
|||
Bound filter can be used to filter by a comparing dimension values to an upper value or/and a lower 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.
"...by comparing dimension..."
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.
done
} | ||
|
||
@Test | ||
public void testSerDesBetweenFilter() throws IOException |
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.
Bound
a6b4d14
to
db6366c
Compare
@himanshug can u please check this |
@b-slim Merge conflicts |
.put(dimensionBytes) | ||
.put((byte) 0xFF) | ||
.put(upperBytes) | ||
.put((byte) 0xFF) |
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.
I think another PR introduced a separate variable for 0xFF in this context, can you use that?
👍 after #1936 (comment) is resolved, pls squash your commits. |
db6366c
to
3253a10
Compare
3253a10
to
77afdf2
Compare
@himanshug done |
👍 for me |
@fjy this is ready to go can you merge it please |
I read this over again, and I think it is cool. 👍 |
…ot be regarded as parsing fail
This Pr is Fix to #1879