-
Notifications
You must be signed in to change notification settings - Fork 537
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
Optimize bins filtering by merging bins #11248
base: demo-rfc80-poc
Are you sure you want to change the base?
Optimize bins filtering by merging bins #11248
Conversation
1f0e84c
to
8f87492
Compare
5fbbefd
to
9e32067
Compare
9e32067
to
ad021d6
Compare
ad021d6
to
abf0718
Compare
@fuzhaoyuan Looks good. Just fix the one sonar issue and we are good |
Fixed. Thank you! |
Quality Gate passedIssues Measures |
src/test/java/org/cbioportal/service/util/StudyViewColumnarServiceUtilTest.java
Show resolved
Hide resolved
/** | ||
* Merge the range of numerical bins in DataFilters to reduce the number of scans that runs on the database when filtering. | ||
*/ | ||
private static <T extends DataFilter> List<T> mergeDataFilters(List<T> filters) { |
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.
We should probably make this public and add a test for this one as well. I noticed that we only have negative values in the tests, may be good to have positive values as well. A mix of positive and negative values would be even better I guess.
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 public you mean we could probably use it somewhere else right? That makes sense. I'm still trying to decide where it's the best place to put it. The test part is easy done
src/main/java/org/cbioportal/service/util/StudyViewColumnarServiceUtil.java
Show resolved
Hide resolved
List<DataFilterValue> mergedValues = new ArrayList<>(); | ||
|
||
BigDecimal mergedStart = null, mergedEnd = null; | ||
for (DataFilterValue dataFilterValue : filter.getValues()) { |
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 logic only works if the bins are sorted properly, right? are we sure that bins are always sorted the way we want?
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 had 2 assumptions: 1) they come in sorted and 2) they're continuous. I handled the discontinuous case by adjacent merging but if sorting is needed we'll need an extra part and way more combinations of possible cases. What would you suggest?
Describe changes proposed in this pull request: