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


##########
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:
   In this constructor we can't use `parentArray[0].length > 0` because 
`parentArray[0]` could be `null` if we had already filled up the first chunk, 
but I actually think we don't need this if statement at all - what are we 
guarding against?



##########
lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/TaxonomyIndexArrays.java:
##########
@@ -80,7 +81,8 @@ public int length() {
 
   public TaxonomyIndexArrays(IndexReader reader) throws IOException {
     int[][] parentArray = allocateChunkedArray(reader.maxDoc(), 0);
-    if (parentArray.length > 0) {
+    assert parentArray.length > 0;
+    if (parentArray[parentArray.length - 1].length > 0) {

Review Comment:
   You're right that this condition is not correct. I'll revert back to 
`parentArray[0].length > 0`.



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