Tim-Brooks commented on code in PR #16227:
URL: https://github.com/apache/lucene/pull/16227#discussion_r3383804880


##########
lucene/core/src/java/org/apache/lucene/index/PointValuesWriter.java:
##########
@@ -116,23 +114,35 @@ void addDense1DLongValues(int firstDocID, 
LongValuesCursor cursor) throws IOExce
     if (size == 0) {
       return;
     }
-    final long ramBefore = reserveDense1D(firstDocID, size);
-    final byte[] dense = pointsDenseBuffer();
+    final long ramBefore = reserveDenseRange(firstDocID, size);
+    final byte[] buffer = sharedScratch.bytesScratch();
     int remaining = size;
     while (remaining > 0) {
       int chunk = Math.min(POINTS_BUFFER_LONG_VALUES, remaining);
-      cursor.fillLongPoints(dense, 0, chunk);
-      bytesOut.writeBytes(dense, 0, chunk * Long.BYTES);
+      cursor.fillLongPoints(buffer, 0, chunk);
+      bytesOut.writeBytes(buffer, 0, chunk * Long.BYTES);
       remaining -= chunk;
     }
-    commitDense1D(firstDocID, size, ramBefore);
+    commitDenseRange(firstDocID, size, ramBefore);
   }
 
-  private byte[] pointsDenseBuffer() {
-    if (densePointsBuffer == null) {
-      densePointsBuffer = new byte[POINTS_BUFFER_BYTES];
+  void addDenseNDValues(int firstDocID, BytesRefValuesCursor cursor) throws 
IOException {
+    final int size = cursor.size();
+    if (size == 0) {
+      return;
+    }
+    final long ramBefore = reserveDenseRange(firstDocID, size);
+    final int width = packedBytesLength;
+    final int perChunk = SharedIndexingScratch.BYTES_SCRATCH_SIZE / width;

Review Comment:
   I added a static assert to identify if the max packed size increases beyond 
the current buffer size.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to