You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/03/04 08:19:52 UTC

[GitHub] [lucene] iverase commented on a change in pull request #709: LUCENE-10311: remove complex cost estimation and abstraction leakage around it

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



##########
File path: lucene/core/src/java/org/apache/lucene/util/DocIdSetBuilder.java
##########
@@ -181,19 +144,27 @@ public void add(DocIdSetIterator iter) throws IOException {
   }
 
   /**
-   * Reserve space and return a {@link BulkAdder} object that can be used to add up to {@code
-   * numDocs} documents.
+   * Reserve space and return a {@link BulkAdder} object that supports up to {@code numAdds}
+   * invocations of {@link BulkAdder#add(int)}.
+   */
+  public BulkAdder grow(long numAdds) {
+    // as an impl detail, we don't need to care about numbers bigger than int32,
+    // we switch over to FixedBitSet storage well before that threshold.
+    return grow((int) Math.min(Integer.MAX_VALUE, numAdds));
+  }
+
+  /**
+   * Reserve space and return a {@link BulkAdder} object that supports up to {@code numAdds}
+   * invocations of {@link BulkAdder#add(int)}.
    */
-  public BulkAdder grow(int numDocs) {
+  public BulkAdder grow(int numAdds) {
     if (bitSet == null) {
-      if ((long) totalAllocated + numDocs <= threshold) {
-        ensureBufferCapacity(numDocs);
+      if ((long) totalAllocated + numAdds <= threshold) {
+        ensureBufferCapacity(numAdds);

Review comment:
       Are we not casting numAdds here back to a long again? I am fine with it.




-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org