jpountz commented on a change in pull request #730: LUCENE-8868: New storing strategy for BKD tree leaves with low cardinality URL: https://github.com/apache/lucene-solr/pull/730#discussion_r296589841
########## File path: lucene/core/src/java/org/apache/lucene/util/bkd/BKDReader.java ########## @@ -480,12 +487,62 @@ void visitDocValues(int[] commonPrefixLengths, byte[] scratchDataPackedValue, by int compressedDim = readCompressedDim(in); if (compressedDim == -1) { - visitRawDocValues(commonPrefixLengths, scratchDataPackedValue, in, docIDs, count, visitor); + visitUniqueRawDocValues(scratchDataPackedValue, docIDs, count, visitor); } else { visitCompressedDocValues(commonPrefixLengths, scratchDataPackedValue, in, docIDs, count, visitor, compressedDim); } } + void visitDocValuesWithCardinality(int[] commonPrefixLengths, byte[] scratchDataPackedValue, byte[] scratchMinIndexPackedValue, byte[] scratchMaxIndexPackedValue, + IndexInput in, int[] docIDs, int count, IntersectVisitor visitor) throws IOException { + + readCommonPrefixes(commonPrefixLengths, scratchDataPackedValue, in); + int compressedDim = readCompressedDim(in); + if (compressedDim == -1) { + //all values are the same + visitor.grow(count); + visitUniqueRawDocValues(scratchDataPackedValue, docIDs, count, visitor); + } else { + if (numIndexDims != 1 && version >= BKDWriter.VERSION_LEAF_STORES_BOUNDS) { + byte[] minPackedValue = scratchMinIndexPackedValue; + System.arraycopy(scratchDataPackedValue, 0, minPackedValue, 0, packedIndexBytesLength); + byte[] maxPackedValue = scratchMaxIndexPackedValue; + //Copy common prefixes before reading adjusted Review comment: can you leave a space between the slashes and the text like we usually do in the rest of the codebase? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org