jpountz commented on code in PR #12658: URL: https://github.com/apache/lucene/pull/12658#discussion_r1356844946
########## lucene/core/src/java/org/apache/lucene/codecs/PointsWriter.java: ########## @@ -202,7 +202,7 @@ public long size() { @Override public int getDocCount() { - throw new UnsupportedOperationException(); + return -1; Review Comment: I don't like that we're returning -1 here since it's not supposed to be a legal return value for `getDocCount()`. Can we do it otherwise somehow? ########## lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java: ########## @@ -1248,7 +1259,8 @@ private void writeIndex( metaOut.writeBytes(maxPackedValue, 0, config.packedIndexBytesLength); metaOut.writeVLong(pointCount); - metaOut.writeVInt(docsSeen.cardinality()); + assert docsSeen != null || docCount != -1; Review Comment: I believe that the assertion is stronger than that, as we can't have docsSeen != null and docCount != -1? ```suggestion assert docsSeen != null ^ docCount != -1; ``` ########## lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java: ########## @@ -519,9 +526,8 @@ private Runnable writeFieldNDims( // compute the min/max for this slice computePackedValueBounds( values, 0, Math.toIntExact(pointCount), minPackedValue, maxPackedValue, scratchBytesRef1); - for (int i = 0; i < Math.toIntExact(pointCount); ++i) { - docsSeen.set(values.getDocID(i)); - } + // docCount has already been set by {@link BKDWriter#writeField} + assert docCount != -1; Review Comment: Should we require that docCount cannot be `-1` in writeField then? -- 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