-
Notifications
You must be signed in to change notification settings - Fork 31
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
Fix label values limits #2272
Fix label values limits #2272
Conversation
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.
Looks good other than that one comment.
@@ -531,6 +522,13 @@ protected static List<ExportedLabelValues> parse(List<Object[]> nodes) { | |||
return exportedLabelValue; | |||
}))); | |||
|
|||
if (limit != null && limit > 0) { | |||
page = (page == null || page < 0) ? 0 : page; | |||
List<List<ExportedLabelValues>> partitioned = Lists.partition(exportedLabelValues.values().stream().toList(), |
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 use Collectors.partitioning/groupingBy instead of Guava Lists?
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.
Good suggestion, let me see if that works since it will avoid to add the new guava dependency only for this
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.
@stalep looks like I was able to get rid of guava
as I don't actually need to partition the records.. I just need to skip the first limit * page
elements and keep the other limit
ones:
if (limit != null && limit > 0) {
long toSkip = (long) limit * ((page == null || page < 0) ? 0 : page);
return exportedLabelValues.values().stream().skip(toSkip).limit(limit).collect(Collectors.toList());
}
wdyt?
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.
Looks good, thanks!
Signed-off-by: Andrea Lamparelli <[email protected]>
89f9e6d
to
edf9b9c
Compare
Fixes Issue
Fixes #2266
Changes proposed
With #1977 we changed how the labelValues implementation was done, the main change was that we moved the run/datasset aggregation from db logic to Java for performance reasons.
Unfortunately this change introduced the regression described in #2266.
With this change I am proposing to move the
limit
logic to Java as well, given that it would be quite not possible to do that at db level given that the aggregation is not there anymore.Check List (Check all the applicable boxes)