jpountz commented on code in PR #14393:
URL: https://github.com/apache/lucene/pull/14393#discussion_r2010004639


##########
lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java:
##########
@@ -596,9 +606,12 @@ private IORunnable writeField1Dim(
       MutablePointTree reader)
       throws IOException {
     MutablePointTreeReaderUtils.sort(config, maxDoc, reader, 0, 
Math.toIntExact(reader.size()));
-
+    final int numLeaves =
+        Math.toIntExact(
+            (reader.size() + config.maxPointsInLeafNode() - 1) / 
config.maxPointsInLeafNode());
+    checkMaxLeafNodeCount(numLeaves);
     final OneDimensionBKDWriter oneDimWriter =
-        new OneDimensionBKDWriter(metaOut, indexOut, dataOut);
+        new OneDimensionBKDWriter(metaOut, indexOut, dataOut, new 
ArrayLongAccumulator(numLeaves));

Review Comment:
   Could/should we use the "packed" impl all the time?



##########
lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java:
##########
@@ -582,8 +584,16 @@ private IORunnable writeFieldNDims(
 
     scratchBytesRef1.length = config.bytesPerDim();
     scratchBytesRef1.bytes = splitPackedValues;
+    final LongValues longValues =

Review Comment:
   Can you give it a less generic name?



##########
lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java:
##########
@@ -687,7 +701,11 @@ private class OneDimensionBKDWriter {
     private int leafCount;
     private int leafCardinality;
 
-    OneDimensionBKDWriter(IndexOutput metaOut, IndexOutput indexOut, 
IndexOutput dataOut) {
+    OneDimensionBKDWriter(
+        IndexOutput metaOut,
+        IndexOutput indexOut,
+        IndexOutput dataOut,
+        LongAccumulator accumulator) {

Review Comment:
   Likewise here, maybe rename to `leafFPAccumulator` or something along these 
lines?



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