jpountz commented on a change in pull request #741: LUCENE-8879: Improve
BKDRadixSelector tests
URL: https://github.com/apache/lucene-solr/pull/741#discussion_r297515568
##########
File path:
lucene/core/src/test/org/apache/lucene/util/bkd/TestBKDRadixSelector.java
##########
@@ -176,14 +180,37 @@ public void testRandomFewDifferentValues() throws
IOException {
points.append(differentValues[random().nextInt(numberValues)], i);
}
points.close();
- verify(dir, points, dimensions, 0, values, partitionPoint, packedLength,
bytesPerDimensions, sortedOnHeap);
+ verify(dir, points, dataDimensions, indexDimensions, 0, values,
partitionPoint, packedLength, bytesPerDimensions, sortedOnHeap);
dir.close();
}
- private void verify(Directory dir, PointWriter points, int dimensions, long
start, long end, long middle, int packedLength, int bytesPerDimensions, int
sortedOnHeap) throws IOException{
- BKDRadixSelector radixSelector = new BKDRadixSelector(dimensions,
bytesPerDimensions, sortedOnHeap, dir, "test");
- //we check for each dimension
- for (int splitDim =0; splitDim < dimensions; splitDim++) {
+ public void testRandomDataDimDiffValues() throws IOException {
+ int values = atLeast(15000);
+ Directory dir = getDirectory(values);
+ int partitionPoint = random().nextInt(values);
+ int sortedOnHeap = random().nextInt(5000);
+ int indexDimensions = TestUtil.nextInt(random(), 1, 8);
+ int dataDimensions = TestUtil.nextInt(random(), indexDimensions, 8);
+ int bytesPerDimensions = TestUtil.nextInt(random(), 2, 30);
+ int packedLength = dataDimensions * bytesPerDimensions;
+ PointWriter points = getRandomPointWriter(dir, values, packedLength);
+ byte[] value = new byte[packedLength];
+ byte[] dataValue = new byte[(dataDimensions - indexDimensions) *
bytesPerDimensions];
+ random().nextBytes(value);
+ for (int i =0; i < values; i++) {
+ random().nextBytes(dataValue);
+ System.arraycopy(dataValue, 0, value, indexDimensions *
bytesPerDimensions, (dataDimensions - indexDimensions) * bytesPerDimensions);
+ points.append(value, i);
+ }
+ points.close();
+ verify(dir, points, dataDimensions, indexDimensions, 0, values,
partitionPoint, packedLength, bytesPerDimensions, sortedOnHeap);
+ dir.close();
+ }
+
+ private void verify(Directory dir, PointWriter points, int dataDimensions,
int indexDimensions, long start, long end, long middle, int packedLength, int
bytesPerDimensions, int sortedOnHeap) throws IOException{
+ BKDRadixSelector radixSelector = new BKDRadixSelector(dataDimensions,
bytesPerDimensions, sortedOnHeap, dir, "test");
+ //we only split by indexed dimension so we check for each only those
dimension
+ for (int splitDim =0; splitDim < indexDimensions; splitDim++) {
Review comment:
please add a space after the equals sign
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]