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-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org