jpountz commented on a change in pull request #556: LUCENE-8673: Use radix partitioning when merging dimensional points URL: https://github.com/apache/lucene-solr/pull/556#discussion_r254265749
########## File path: lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextBKDWriter.java ########## @@ -1355,91 +1111,67 @@ assert valuesInOrderAndBounds(count, sortedDim, minPackedValue, maxPackedValue, splitDim = 0; } - PathSlice source = slices[splitDim]; - assert nodeID < splitPackedValues.length: "nodeID=" + nodeID + " splitValues.length=" + splitPackedValues.length; + assert nodeID < splitPackedValues.length : "nodeID=" + nodeID + " splitValues.length=" + splitPackedValues.length; // How many points will be in the left tree: - long rightCount = source.count / 2; - long leftCount = source.count - rightCount; + long rightCount = data.count() / 2; + long leftCount = data.count() - rightCount; + + PointWriter leftPointWriter; + PointWriter rightPointWriter; + byte[] splitValue; + + try (PointWriter leftPointWriter2 = getPointWriter(leftCount, "left" + splitDim); + PointWriter rightPointWriter2 = getPointWriter(rightCount, "right" + splitDim)) { + splitValue = radixSelector.select(data, leftPointWriter2, rightPointWriter2, 0, Math.toIntExact(data.count()), Math.toIntExact(leftCount), splitDim); Review comment: I think we should not call toIntExact here, the count can be > Integer.MAX_VALUE sometimes, and it's fine? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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