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 2021/12/06 11:48:09 UTC
[GitHub] [lucene] iverase opened a new pull request #520: LUCENE-10289: Change DocIdSetBuilder#grow() from taking an int to a long
iverase opened a new pull request #520:
URL: https://github.com/apache/lucene/pull/520
It makes sense as it is possible to bulk add more than Integer.MAX_VALUE docs as there can be duplicates.
--
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
[GitHub] [lucene] iverase commented on a change in pull request #520: LUCENE-10289: Change DocIdSetBuilder#grow() from taking an int to a long
Posted by GitBox <gi...@apache.org>.
iverase commented on a change in pull request #520:
URL: https://github.com/apache/lucene/pull/520#discussion_r763060170
##########
File path: lucene/core/src/java/org/apache/lucene/util/DocIdSetBuilder.java
##########
@@ -184,10 +184,11 @@ 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.
*/
- public BulkAdder grow(int numDocs) {
+ public BulkAdder grow(long numDocs) {
if (bitSet == null) {
if ((long) totalAllocated + numDocs <= threshold) {
- ensureBufferCapacity(numDocs);
+ // threshold is an int, cast is safe
+ ensureBufferCapacity((int) numDocs);
Review comment:
Ok, out of paranoia I have added checks for long overflow too
--
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
[GitHub] [lucene] iverase merged pull request #520: LUCENE-10289: Change DocIdSetBuilder#grow() from taking an int to a long
Posted by GitBox <gi...@apache.org>.
iverase merged pull request #520:
URL: https://github.com/apache/lucene/pull/520
--
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
[GitHub] [lucene] iverase commented on a change in pull request #520: LUCENE-10289: Change DocIdSetBuilder#grow() from taking an int to a long
Posted by GitBox <gi...@apache.org>.
iverase commented on a change in pull request #520:
URL: https://github.com/apache/lucene/pull/520#discussion_r763060170
##########
File path: lucene/core/src/java/org/apache/lucene/util/DocIdSetBuilder.java
##########
@@ -184,10 +184,11 @@ 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.
*/
- public BulkAdder grow(int numDocs) {
+ public BulkAdder grow(long numDocs) {
if (bitSet == null) {
if ((long) totalAllocated + numDocs <= threshold) {
- ensureBufferCapacity(numDocs);
+ // threshold is an int, cast is safe
+ ensureBufferCapacity((int) numDocs);
Review comment:
Ok, out of paranoia I have added checks for long Overflow too
--
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
[GitHub] [lucene] jpountz commented on a change in pull request #520: LUCENE-10289: Change DocIdSetBuilder#grow() from taking an int to a long
Posted by GitBox <gi...@apache.org>.
jpountz commented on a change in pull request #520:
URL: https://github.com/apache/lucene/pull/520#discussion_r763049319
##########
File path: lucene/CHANGES.txt
##########
@@ -100,6 +100,8 @@ Other
* LUCENE-10284: Upgrade morfologik-stemming to 2.1.8. (Dawid Weiss)
+LUCENE-10289: DocIdSetBuilder#grow() takes now a long instead of an int. (Ignacio Vera)
Review comment:
```suggestion
* LUCENE-10289: DocIdSetBuilder#grow() takes now a long instead of an int. (Ignacio Vera)
```
##########
File path: lucene/core/src/java/org/apache/lucene/util/DocIdSetBuilder.java
##########
@@ -184,10 +184,11 @@ 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.
*/
- public BulkAdder grow(int numDocs) {
+ public BulkAdder grow(long numDocs) {
if (bitSet == null) {
if ((long) totalAllocated + numDocs <= threshold) {
- ensureBufferCapacity(numDocs);
+ // threshold is an int, cast is safe
+ ensureBufferCapacity((int) numDocs);
Review comment:
can you still use `Math.toIntExact` instead for safety?
##########
File path: lucene/CHANGES.txt
##########
@@ -100,6 +100,8 @@ Other
* LUCENE-10284: Upgrade morfologik-stemming to 2.1.8. (Dawid Weiss)
+LUCENE-10289: DocIdSetBuilder#grow() takes now a long instead of an int. (Ignacio Vera)
Review comment:
Also, move the CHANGES entry under `API changes`?
--
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
[GitHub] [lucene] iverase commented on a change in pull request #520: LUCENE-10289: Change DocIdSetBuilder#grow() from taking an int to a long
Posted by GitBox <gi...@apache.org>.
iverase commented on a change in pull request #520:
URL: https://github.com/apache/lucene/pull/520#discussion_r763060400
##########
File path: lucene/CHANGES.txt
##########
@@ -100,6 +100,8 @@ Other
* LUCENE-10284: Upgrade morfologik-stemming to 2.1.8. (Dawid Weiss)
+LUCENE-10289: DocIdSetBuilder#grow() takes now a long instead of an int. (Ignacio Vera)
Review comment:
done
--
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