iverase commented on a change in pull request #7:
URL: https://github.com/apache/lucene/pull/7#discussion_r728659741



##########
File path: lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java
##########
@@ -318,20 +316,28 @@ private boolean collectNextLeaf() throws IOException {
   private static class MergeIntersectsVisitor implements IntersectVisitor {
 
     int docsInBlock = 0;
-    final byte[] packedValues;
-    final int[] docIDs;
+    byte[] packedValues;
+    int[] docIDs;
     private final int packedBytesLength;
 
-    MergeIntersectsVisitor(int packedBytesLength, int maxPointsInLeafNode) {
-      this.docIDs = new int[maxPointsInLeafNode];
-      this.packedValues = new byte[maxPointsInLeafNode * packedBytesLength];
+    MergeIntersectsVisitor(int packedBytesLength) {
+      this.docIDs = new int[0];
+      this.packedValues = new byte[0];
       this.packedBytesLength = packedBytesLength;
     }
 
     void reset() {
       docsInBlock = 0;
     }
 
+    @Override
+    public void grow(int count) {
+      if (docIDs.length - docsInBlock < count) {
+        docIDs = ArrayUtil.growExact(docIDs, count + docsInBlock);

Review comment:
       It makes sense.




-- 
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]

Reply via email to