msfroh commented on code in PR #13028:
URL: https://github.com/apache/lucene/pull/13028#discussion_r1463878454


##########
lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/TaxonomyIndexArrays.java:
##########
@@ -95,7 +97,8 @@ public TaxonomyIndexArrays(IndexReader reader, 
TaxonomyIndexArrays copyFrom) thr
     // NRT reader was obtained, even though nothing was changed. this is not 
very likely
     // to happen.
     int[][] parentArray = allocateChunkedArray(reader.maxDoc(), 
copyFrom.parents.values.length - 1);
-    if (parentArray.length > 0) {
+    assert parentArray.length > 0;
+    if (parentArray[parentArray.length - 1].length > 0) {

Review Comment:
   Actually, I guess my concern above was about the case where we start with a 
multiple of `CHUNK_SIZE`. This one kicks in when we grow to a multiple of 
`CHUNK_SIZE`.
   
   Either way, I think the condition is going to hit us when we have that 
trailing empty array. 
   
   Could the condition be `if (parentArray[0].length > 0)`, since we have the 
assert to say that `parentArray` always has at least one element (which could 
be empty)?



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

Reply via email to