mirror of https://github.com/apache/lucene.git
fix overflows in compound assignments (#11938)
* Count points as longs. * Simplify KnnVectorsWriter. Co-authored-by: Adrien Grand <jpountz@gmail.com>
This commit is contained in:
parent
a5e2525946
commit
c5da727493
|
@ -108,7 +108,6 @@ public abstract class KnnVectorsWriter implements Accountable, Closeable {
|
|||
protected static class MergedVectorValues extends VectorValues {
|
||||
private final List<VectorValuesSub> subs;
|
||||
private final DocIDMerger<VectorValuesSub> docIdMerger;
|
||||
private final int cost;
|
||||
private final int size;
|
||||
|
||||
private int docId;
|
||||
|
@ -136,12 +135,10 @@ public abstract class KnnVectorsWriter implements Accountable, Closeable {
|
|||
throws IOException {
|
||||
this.subs = subs;
|
||||
docIdMerger = DocIDMerger.of(subs, mergeState.needsIndexSort);
|
||||
int totalCost = 0, totalSize = 0;
|
||||
int totalSize = 0;
|
||||
for (VectorValuesSub sub : subs) {
|
||||
totalCost += sub.values.cost();
|
||||
totalSize += sub.values.size();
|
||||
}
|
||||
cost = totalCost;
|
||||
size = totalSize;
|
||||
docId = -1;
|
||||
}
|
||||
|
@ -184,7 +181,7 @@ public abstract class KnnVectorsWriter implements Accountable, Closeable {
|
|||
|
||||
@Override
|
||||
public long cost() {
|
||||
return cost;
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -415,7 +415,7 @@ public abstract class PointRangeQuery extends Query {
|
|||
BiFunction<byte[], byte[], Relation> nodeComparator,
|
||||
Predicate<byte[]> leafComparator)
|
||||
throws IOException {
|
||||
final int[] matchingNodeCount = {0};
|
||||
final long[] matchingNodeCount = {0};
|
||||
// create a custom IntersectVisitor that records the number of leafNodes that matched
|
||||
final IntersectVisitor visitor =
|
||||
new IntersectVisitor() {
|
||||
|
@ -446,7 +446,7 @@ public abstract class PointRangeQuery extends Query {
|
|||
}
|
||||
|
||||
private void pointCount(
|
||||
IntersectVisitor visitor, PointValues.PointTree pointTree, int[] matchingNodeCount)
|
||||
IntersectVisitor visitor, PointValues.PointTree pointTree, long[] matchingNodeCount)
|
||||
throws IOException {
|
||||
Relation r = visitor.compare(pointTree.getMinPackedValue(), pointTree.getMaxPackedValue());
|
||||
switch (r) {
|
||||
|
|
|
@ -141,7 +141,7 @@ public class OfflineSorter {
|
|||
/** number of partition merges */
|
||||
public int mergeRounds;
|
||||
/** number of lines of data read */
|
||||
public int lineCount;
|
||||
public long lineCount;
|
||||
/** time spent merging sorted partitions (in milliseconds) */
|
||||
public final AtomicLong mergeTimeMS = new AtomicLong();
|
||||
/** time spent sorting data (in milliseconds) */
|
||||
|
|
Loading…
Reference in New Issue