Jackie-Jiang commented on code in PR #13525:
URL: https://github.com/apache/pinot/pull/13525#discussion_r1668954123
##########
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/VectorTest.java:
##########
@@ -331,7 +331,9 @@ private float[] createZeroVector(int vectorDimSize) {
private float[] createRandomVector(int vectorDimSize) {
float[] vector = new float[vectorDimSize];
- IntStream.range(0, vectorDimSize).forEach(i -> vector[i] =
RandomUtils.nextFloat(0.0f, 1.0f));
+ float range = 1.0f - 0.0f;
+ Random random = new Random();
+ IntStream.range(0, vectorDimSize).forEach(i -> vector[i] =
random.nextFloat() * range + 0.0f);
Review Comment:
```suggestion
Random random = new Random();
for (int i = 0; i < vectorDimSize; i++) {
vector[i] = random.nextFloat();
}
```
##########
pinot-core/src/test/java/org/apache/pinot/queries/NoDictionaryCompressionQueriesTest.java:
##########
@@ -216,11 +215,11 @@ private List<GenericRow> createTestData() {
//Generate random data
int rowLength = 1000;
- Random random = new Random();
String[] tempStringRows = new String[rowLength];
Integer[] tempIntRows = new Integer[rowLength];
Long[] tempLongRows = new Long[rowLength];
+ ThreadLocalRandom random = ThreadLocalRandom.current();
Review Comment:
(minor) Use regular `Random` to be consistent with other tests
##########
pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/BaseTransformFunctionTest.java:
##########
@@ -203,9 +202,11 @@ public void setUp()
_doubleMV2Values[i][j] = 1.0;
}
+ float range = 1.0f - 0.0f;
+ Random random = new Random();
for (int j = 0; j < VECTOR_DIM_SIZE; j++) {
- _vector1Values[i][j] = Math.abs(RandomUtils.nextFloat(0.0f, 1.0f));
- _vector2Values[i][j] = Math.abs(RandomUtils.nextFloat(0.0f, 1.0f));
+ _vector1Values[i][j] = Math.abs(random.nextFloat() * range + 0.0f);
Review Comment:
Per the documentation, `Random.nextFloat()` will generate a value from 0.0
to 1.0
```suggestion
_vector1Values[i][j] = random.nextFloat();
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]