gautamworah96 commented on a change in pull request #191:
URL: https://github.com/apache/lucene/pull/191#discussion_r660149249
##########
File path:
lucene/facet/src/test/org/apache/lucene/facet/TestLongValueFacetCounts.java
##########
@@ -382,19 +383,19 @@ public void testRandomMultiValued() throws Exception {
+ allSingleValued);
}
- long[][] values = new long[valueCount][];
- for (int i = 0; i < valueCount; i++) {
+ Long[][] values = new Long[docCount][];
Review comment:
Sure. The next commit uses `long`s everywhere instead of `Long`s.
Just out of curiosity: why do we prefer a `long` over a `Long`? Saves us
boxing/unboxing time?
##########
File path:
lucene/facet/src/test/org/apache/lucene/facet/TestLongValueFacetCounts.java
##########
@@ -382,19 +383,19 @@ public void testRandomMultiValued() throws Exception {
+ allSingleValued);
}
- long[][] values = new long[valueCount][];
- for (int i = 0; i < valueCount; i++) {
+ Long[][] values = new Long[docCount][];
Review comment:
Sure.
The next commit uses `long`s everywhere instead of `Long`s. It sorts values
manually (because they are randomly generated) and then uses the same logic of
comparing with the previous value.
Just out of curiosity: why do we prefer a `long` over a `Long`? Saves us
boxing/unboxing time?
##########
File path:
lucene/facet/src/test/org/apache/lucene/facet/TestLongValueFacetCounts.java
##########
@@ -517,22 +512,15 @@ public void testRandomMultiValued() throws Exception {
facetCounts = new LongValueFacetCounts("field", fc);
expected = new HashMap<>();
- expectedChildCount = 0;
- int totCount = 0;
Review comment:
`totCount` was an extra variable with just a different name and
`expectedChildCount` was just tracking the number of unique values. We can get
that from the size of the map instead
##########
File path:
lucene/facet/src/java/org/apache/lucene/facet/LongValueFacetCounts.java
##########
@@ -162,8 +162,14 @@ private void count(String field, List<MatchingDocs>
matchingDocs) throws IOExcep
if (limit > 0) {
totCount++;
}
+ Long previousValue = null;
Review comment:
Fixed this in the next commit 6b2019e
##########
File path:
lucene/facet/src/test/org/apache/lucene/facet/TestLongValueFacetCounts.java
##########
@@ -382,19 +383,19 @@ public void testRandomMultiValued() throws Exception {
+ allSingleValued);
}
- long[][] values = new long[valueCount][];
- for (int i = 0; i < valueCount; i++) {
+ Long[][] values = new Long[docCount][];
Review comment:
Sure.
The next commit uses `long`s everywhere instead of `Long`s. In the test
class, it sorts values manually (because they are randomly generated) and then
uses the same logic of comparing with the previous value.
Just out of curiosity: why do we prefer a `long` over a `Long`? Saves us
boxing/unboxing time?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]