Skip to content

Apache Lucene open-source search software

SOLR-2068: fix bugs, but leave disabled due to missing support for null values

Yonik Seeleyaf6ce50a9d23
diff --git a/solr/src/java/org/apache/solr/search/Grouping.java b/solr/src/java/org/apache/solr/search/Grouping.java
index fddf21d238d..cb335955915 100755
--- a/solr/src/java/org/apache/solr/search/Grouping.java
+++ b/solr/src/java/org/apache/solr/search/Grouping.java
@@ -707,9 +707,9 @@ class SearchGroupDocs {
class Phase2StringGroupCollector extends Phase2GroupCollector {
FieldCache.DocTermsIndex index;
- SentinelIntSet ordSet;
- SearchGroupDocs[] groups;
- BytesRef spare;
+ final SentinelIntSet ordSet;
+ final SearchGroupDocs[] groups;
+ final BytesRef spare = new BytesRef();
public Phase2StringGroupCollector(TopGroupCollector topGroups, ValueSource groupByVS, Map vsContext, Sort sort, int docsPerGroup, boolean getScores, int offset) throws IOException {
super(topGroups, groupByVS, vsContext,sort,docsPerGroup,getScores,offset);
diff --git a/solr/src/java/org/apache/solr/util/SentinelIntSet.java b/solr/src/java/org/apache/solr/util/SentinelIntSet.java
index 28ed7eba81f..fc4d120e7d5 100644
--- a/solr/src/java/org/apache/solr/util/SentinelIntSet.java
+++ b/solr/src/java/org/apache/solr/util/SentinelIntSet.java
@@ -30,7 +30,7 @@ public class SentinelIntSet {
this.emptyVal = emptyVal;
int tsize = Math.max(org.apache.lucene.util.BitUtil.nextHighestPowerOfTwo(size), 1);
rehashCount = tsize - (tsize>>2);
- if (tsize <= rehashCount) {
+ if (size >= rehashCount) { // should be able to hold "size" w/o rehashing
tsize <<= 1;
rehashCount = tsize - (tsize>>2);
}
@@ -117,6 +117,8 @@ public class SentinelIntSet {
startRehash(newSize);
int[] oldKeys = keys;
keys = new int[newSize];
+ if (emptyVal != 0) Arrays.fill(keys, emptyVal);
+
for (int i=0; i<oldKeys.length; i++) {
int key = oldKeys[i];
if (key == emptyVal) continue;