mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-28 19:08:40 +00:00
remove codeQL warning about implicit narrowing conversion in compound assignment (#1403)
Signed-off-by: Xue Zhou <xuezhou@amazon.com>
This commit is contained in:
parent
af6ae752b4
commit
f54cc382d5
libs/nio/src/test/java/org/opensearch/nio
plugins/examples/rescore/src/main/java/org/opensearch/example/rescore
server/src
main/java/org/opensearch/search/aggregations/bucket
test/java/org/opensearch
action/search
index
search/aggregations
test/framework/src/main/java/org/opensearch/common/bytes
@ -266,10 +266,10 @@ public class InboundChannelBufferTests extends OpenSearchTestCase {
|
|||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
long bytesToRelease = Math.min(randomInt(50), channelBuffer.getIndex());
|
long bytesToRelease = Math.min(randomInt(50), channelBuffer.getIndex());
|
||||||
channelBuffer.release(bytesToRelease);
|
channelBuffer.release(bytesToRelease);
|
||||||
bytesReleased += bytesToRelease;
|
bytesReleased += (int) bytesToRelease;
|
||||||
}
|
}
|
||||||
channelBuffer.incrementIndex(amountToInc);
|
channelBuffer.incrementIndex(amountToInc);
|
||||||
indexIncremented += amountToInc;
|
indexIncremented += (int) amountToInc;
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEquals(0, channelBuffer.sliceBuffersFrom(channelBuffer.getIndex()).length);
|
assertEquals(0, channelBuffer.sliceBuffersFrom(channelBuffer.getIndex()).length);
|
||||||
|
@ -222,7 +222,7 @@ public class ExampleRescoreBuilder extends RescorerBuilder<ExampleRescoreBuilder
|
|||||||
+ "]"
|
+ "]"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
topDocs.scoreDocs[i].score *= data.nextValue();
|
topDocs.scoreDocs[i].score *= (float) data.nextValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Sort by score descending, then docID ascending, just like lucene's QueryRescorer
|
// Sort by score descending, then docID ascending, just like lucene's QueryRescorer
|
||||||
|
@ -195,7 +195,7 @@ public class BestBucketsDeferringCollector extends DeferringBucketCollector {
|
|||||||
final PackedLongValues.Iterator buckets = entry.buckets.iterator();
|
final PackedLongValues.Iterator buckets = entry.buckets.iterator();
|
||||||
int doc = 0;
|
int doc = 0;
|
||||||
for (long i = 0, end = entry.docDeltas.size(); i < end; ++i) {
|
for (long i = 0, end = entry.docDeltas.size(); i < end; ++i) {
|
||||||
doc += docDeltaIterator.next();
|
doc += (int) docDeltaIterator.next();
|
||||||
final long bucket = buckets.next();
|
final long bucket = buckets.next();
|
||||||
final long rebasedBucket = this.selectedBuckets.find(bucket);
|
final long rebasedBucket = this.selectedBuckets.find(bucket);
|
||||||
if (rebasedBucket != -1) {
|
if (rebasedBucket != -1) {
|
||||||
|
@ -396,7 +396,7 @@ public class SearchPhaseControllerTests extends OpenSearchTestCase {
|
|||||||
for (SearchPhaseResult shardResult : results.asList()) {
|
for (SearchPhaseResult shardResult : results.asList()) {
|
||||||
TopDocs topDocs = shardResult.queryResult().topDocs().topDocs;
|
TopDocs topDocs = shardResult.queryResult().topDocs().topDocs;
|
||||||
assert topDocs.totalHits.relation == Relation.EQUAL_TO;
|
assert topDocs.totalHits.relation == Relation.EQUAL_TO;
|
||||||
resultCount += topDocs.totalHits.value;
|
resultCount += (int) topDocs.totalHits.value;
|
||||||
}
|
}
|
||||||
return resultCount;
|
return resultCount;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ public class StoreRecoveryTests extends OpenSearchTestCase {
|
|||||||
&& f.equals("write.lock") == false
|
&& f.equals("write.lock") == false
|
||||||
&& f.startsWith("extra") == false;
|
&& f.startsWith("extra") == false;
|
||||||
for (Directory d : dirs) {
|
for (Directory d : dirs) {
|
||||||
numFiles += Arrays.asList(d.listAll()).stream().filter(filesFilter).count();
|
numFiles += (int) Arrays.asList(d.listAll()).stream().filter(filesFilter).count();
|
||||||
}
|
}
|
||||||
final long targetNumFiles = Arrays.asList(target.listAll()).stream().filter(filesFilter).count();
|
final long targetNumFiles = Arrays.asList(target.listAll()).stream().filter(filesFilter).count();
|
||||||
assertEquals(numFiles, targetNumFiles);
|
assertEquals(numFiles, targetNumFiles);
|
||||||
|
@ -169,7 +169,7 @@ public class FileInfoTests extends OpenSearchTestCase {
|
|||||||
);
|
);
|
||||||
int numBytes = 0;
|
int numBytes = 0;
|
||||||
for (int i = 0; i < info.numberOfParts(); i++) {
|
for (int i = 0; i < info.numberOfParts(); i++) {
|
||||||
numBytes += info.partBytes(i);
|
numBytes += (int) info.partBytes(i);
|
||||||
}
|
}
|
||||||
assertEquals(numBytes, 36);
|
assertEquals(numBytes, 36);
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ public class FileInfoTests extends OpenSearchTestCase {
|
|||||||
);
|
);
|
||||||
numBytes = 0;
|
numBytes = 0;
|
||||||
for (int i = 0; i < info.numberOfParts(); i++) {
|
for (int i = 0; i < info.numberOfParts(); i++) {
|
||||||
numBytes += info.partBytes(i);
|
numBytes += (int) info.partBytes(i);
|
||||||
}
|
}
|
||||||
assertEquals(numBytes, 35);
|
assertEquals(numBytes, 35);
|
||||||
final int numIters = randomIntBetween(10, 100);
|
final int numIters = randomIntBetween(10, 100);
|
||||||
@ -189,7 +189,7 @@ public class FileInfoTests extends OpenSearchTestCase {
|
|||||||
info = new BlobStoreIndexShardSnapshot.FileInfo("foo", metadata, new ByteSizeValue(randomIntBetween(1, 1000)));
|
info = new BlobStoreIndexShardSnapshot.FileInfo("foo", metadata, new ByteSizeValue(randomIntBetween(1, 1000)));
|
||||||
numBytes = 0;
|
numBytes = 0;
|
||||||
for (int i = 0; i < info.numberOfParts(); i++) {
|
for (int i = 0; i < info.numberOfParts(); i++) {
|
||||||
numBytes += info.partBytes(i);
|
numBytes += (int) info.partBytes(i);
|
||||||
}
|
}
|
||||||
assertEquals(numBytes, metadata.length());
|
assertEquals(numBytes, metadata.length());
|
||||||
}
|
}
|
||||||
|
2
server/src/test/java/org/opensearch/search/aggregations/bucket/range/InternalBinaryRangeTests.java
2
server/src/test/java/org/opensearch/search/aggregations/bucket/range/InternalBinaryRangeTests.java
@ -114,7 +114,7 @@ public class InternalBinaryRangeTests extends InternalRangeTestCase<InternalBina
|
|||||||
for (Range.Bucket bucket : reduced.getBuckets()) {
|
for (Range.Bucket bucket : reduced.getBuckets()) {
|
||||||
int expectedCount = 0;
|
int expectedCount = 0;
|
||||||
for (InternalBinaryRange input : inputs) {
|
for (InternalBinaryRange input : inputs) {
|
||||||
expectedCount += input.getBuckets().get(pos).getDocCount();
|
expectedCount += (int) input.getBuckets().get(pos).getDocCount();
|
||||||
}
|
}
|
||||||
assertEquals(expectedCount, bucket.getDocCount());
|
assertEquals(expectedCount, bucket.getDocCount());
|
||||||
pos++;
|
pos++;
|
||||||
|
@ -252,7 +252,7 @@ public class SumAggregatorTests extends AggregatorTestCase {
|
|||||||
int sum = 0;
|
int sum = 0;
|
||||||
for (int i = 0; i < numDocs; i++) {
|
for (int i = 0; i < numDocs; i++) {
|
||||||
final long value = randomLongBetween(0, 1000);
|
final long value = randomLongBetween(0, 1000);
|
||||||
sum += value;
|
sum += (int) value;
|
||||||
docs.add(singleton(new NumericDocValuesField(fieldType.name(), value)));
|
docs.add(singleton(new NumericDocValuesField(fieldType.name(), value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ public abstract class AbstractBytesReferenceTestCase extends OpenSearchTestCase
|
|||||||
assertNotEquals(b1, differentLen);
|
assertNotEquals(b1, differentLen);
|
||||||
|
|
||||||
// test changed bytes
|
// test changed bytes
|
||||||
array1[offset1 + randomInt(len - 1)] += 13;
|
array1[offset1 + randomInt(len - 1)] += (byte) 13;
|
||||||
assertNotEquals(b1, b2);
|
assertNotEquals(b1, b2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user