-
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
time-descending result of select queries #2271
Conversation
return offset + (descending ? -counter : counter); | ||
} | ||
|
||
static int toDelta(int offset, boolean descending) |
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.
can we have some different names between these offsets and the one defined in the class?
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.
renamed offset in the class to startOffset
5d99df4
to
63d2213
Compare
👍 @navis please add documentation for select query that it is reversible |
340617c
to
5caaf9b
Compare
updated document |
@@ -1134,6 +1136,12 @@ public SelectQueryBuilder intervals(List<Interval> l) | |||
return this; | |||
} | |||
|
|||
public SelectQueryBuilder descending(boolean descending) |
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.
setDescending
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 see other methods in this class violate "normal" bean naming conventions. Oh well...
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 any other comments? I think this is pretty close to ready
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.
Also I think in Druids and in other places, we did not follow the 'set' convention in most of the builder classes.
@himanshug can you take a look? |
private boolean checkPagingSpec(PagingSpec pagingSpec, boolean descending) | ||
{ | ||
for (Integer value : pagingSpec.getPagingIdentifiers().values()) { | ||
if (descending ^ value < 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 a part of the java spec I'm not as familiar with. Is this doing ((descending ? 1 : 0) ^ value) < 0
or descending ^ (value < 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.
IntelliJ says it's descending ^ (value < 0)
. I'll add clarifying parentheses.
5caaf9b
to
b1e3923
Compare
|
||
int offset = 0; | ||
while (!cursor.isDone() && offset < query.getPagingSpec().getThreshold()) { | ||
for (; !cursor.isDone() && offset.hasNext(); cursor.advance(), offset.next()) { |
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 so much tidier now
Functionality looks good. Have some outstanding questions about docs and possibly some more unit tests. |
Also please squash soon, this is very close to ready |
@navis can you squash commits? |
squashed |
@drcrallen any more comments? |
is not squashed :) did @navis forget to push? |
@navis ? |
Ah, sorry. I've confused with other issue. |
8301f47
to
55a888e
Compare
👍 |
time-descending result of select queries
#2014 for select query