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 11:31:42 UTC
[GitHub] [lucene] rmuir commented on a change in pull request #709: LUCENE-10311: remove complex cost estimation and abstraction leakage around it
rmuir commented on a change in pull request #709:
URL: https://github.com/apache/lucene/pull/709#discussion_r819493935
##########
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:
i find it weird to have a `grow(long)` at all when no sizes above ~8.3 million matter at all. But I'm trying to compromise here.
--
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