Skip to content

Commit b0a35b1

Browse files
committed
Fix random DocVector generation (shard cannot be negative)
1 parent 1ad8eb4 commit b0a35b1

File tree

1 file changed

+2
-1
lines changed
  • x-pack/plugin/esql/compute/test/src/main/java/org/elasticsearch/compute/test

1 file changed

+2
-1
lines changed

x-pack/plugin/esql/compute/test/src/main/java/org/elasticsearch/compute/test/BlockTestUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import static org.elasticsearch.test.ESTestCase.randomFloat;
3939
import static org.elasticsearch.test.ESTestCase.randomInt;
4040
import static org.elasticsearch.test.ESTestCase.randomLong;
41+
import static org.elasticsearch.test.ESTestCase.randomNonNegativeInt;
4142
import static org.elasticsearch.test.ESTestCase.randomRealisticUnicodeOfCodepointLengthBetween;
4243
import static org.hamcrest.Matchers.equalTo;
4344
import static org.junit.Assert.assertThat;
@@ -54,7 +55,7 @@ public static Object randomValue(ElementType e) {
5455
case DOUBLE -> randomDouble();
5556
case BYTES_REF -> new BytesRef(randomRealisticUnicodeOfCodepointLengthBetween(0, 5)); // TODO: also test spatial WKB
5657
case BOOLEAN -> randomBoolean();
57-
case DOC -> new BlockUtils.Doc(randomInt(), randomInt(), between(0, Integer.MAX_VALUE));
58+
case DOC -> new BlockUtils.Doc(randomNonNegativeInt(), randomInt(), between(0, Integer.MAX_VALUE));
5859
case NULL -> null;
5960
case COMPOSITE -> throw new IllegalArgumentException("can't make random values for composite");
6061
case AGGREGATE_METRIC_DOUBLE -> throw new IllegalArgumentException("can't make random values for aggregate_metric_double");

0 commit comments

Comments
 (0)