Skip to content

Commit bb68715

Browse files
committed
Merge branch 'main' into google-vertexai-chatcompletion
2 parents efb90ba + 8929a64 commit bb68715

File tree

904 files changed

+23128
-3323
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

904 files changed

+23128
-3323
lines changed

.buildkite/pipelines/periodic-packaging.template.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ steps:
4040
setup:
4141
image:
4242
- windows-2022
43+
- windows-2025
4344
agents:
4445
provider: gcp
4546
image: family/elasticsearch-{{matrix.image}}

.buildkite/pipelines/periodic-packaging.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ steps:
393393
setup:
394394
image:
395395
- windows-2022
396+
- windows-2025
396397
agents:
397398
provider: gcp
398399
image: family/elasticsearch-{{matrix.image}}

.buildkite/pipelines/periodic-platform-support.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ steps:
3838
setup:
3939
image:
4040
- windows-2022
41+
- windows-2025
4142
GRADLE_TASK:
4243
- checkPart1
4344
- checkPart2

.buildkite/pipelines/pull-request/packaging-tests-windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ steps:
1111
setup:
1212
image:
1313
- windows-2022
14+
- windows-2025
1415
PACKAGING_TASK:
1516
- default-windows-archive
1617
agents:

benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/EvalBenchmark.java

Lines changed: 150 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.elasticsearch.common.breaker.NoopCircuitBreaker;
1414
import org.elasticsearch.common.logging.LogConfigurator;
1515
import org.elasticsearch.common.settings.Settings;
16+
import org.elasticsearch.common.unit.ByteSizeUnit;
1617
import org.elasticsearch.common.util.BigArrays;
1718
import org.elasticsearch.compute.data.Block;
1819
import org.elasticsearch.compute.data.BlockFactory;
@@ -44,13 +45,15 @@
4445
import org.elasticsearch.xpack.esql.expression.function.scalar.conditional.Case;
4546
import org.elasticsearch.xpack.esql.expression.function.scalar.date.DateTrunc;
4647
import org.elasticsearch.xpack.esql.expression.function.scalar.math.Abs;
48+
import org.elasticsearch.xpack.esql.expression.function.scalar.math.RoundTo;
4749
import org.elasticsearch.xpack.esql.expression.function.scalar.multivalue.MvMin;
4850
import org.elasticsearch.xpack.esql.expression.function.scalar.nulls.Coalesce;
4951
import org.elasticsearch.xpack.esql.expression.function.scalar.string.RLike;
5052
import org.elasticsearch.xpack.esql.expression.function.scalar.string.ToLower;
5153
import org.elasticsearch.xpack.esql.expression.function.scalar.string.ToUpper;
5254
import org.elasticsearch.xpack.esql.expression.predicate.operator.arithmetic.Add;
5355
import org.elasticsearch.xpack.esql.expression.predicate.operator.comparison.Equals;
56+
import org.elasticsearch.xpack.esql.expression.predicate.operator.comparison.LessThan;
5457
import org.elasticsearch.xpack.esql.planner.Layout;
5558
import org.elasticsearch.xpack.esql.plugin.EsqlPlugin;
5659
import org.elasticsearch.xpack.esql.session.Configuration;
@@ -128,6 +131,10 @@ static void selfTest() {
128131
"long_equal_to_int",
129132
"mv_min",
130133
"mv_min_ascending",
134+
"round_to_4_via_case",
135+
"round_to_2",
136+
"round_to_3",
137+
"round_to_4",
131138
"rlike",
132139
"to_lower",
133140
"to_lower_ords",
@@ -240,6 +247,65 @@ private static EvalOperator.ExpressionEvaluator evaluator(String operation) {
240247
RLike rlike = new RLike(Source.EMPTY, keywordField, new RLikePattern(".ar"));
241248
yield EvalMapper.toEvaluator(FOLD_CONTEXT, rlike, layout(keywordField)).get(driverContext);
242249
}
250+
case "round_to_4_via_case" -> {
251+
FieldAttribute f = longField();
252+
253+
Expression ltkb = new LessThan(Source.EMPTY, f, kb());
254+
Expression ltmb = new LessThan(Source.EMPTY, f, mb());
255+
Expression ltgb = new LessThan(Source.EMPTY, f, gb());
256+
EvalOperator.ExpressionEvaluator evaluator = EvalMapper.toEvaluator(
257+
FOLD_CONTEXT,
258+
new Case(Source.EMPTY, ltkb, List.of(b(), ltmb, kb(), ltgb, mb(), gb())),
259+
layout(f)
260+
).get(driverContext);
261+
String desc = "CaseLazyEvaluator";
262+
if (evaluator.toString().contains(desc) == false) {
263+
throw new IllegalArgumentException("Evaluator was [" + evaluator + "] but expected one containing [" + desc + "]");
264+
}
265+
yield evaluator;
266+
}
267+
case "round_to_2" -> {
268+
FieldAttribute f = longField();
269+
270+
EvalOperator.ExpressionEvaluator evaluator = EvalMapper.toEvaluator(
271+
FOLD_CONTEXT,
272+
new RoundTo(Source.EMPTY, f, List.of(b(), kb())),
273+
layout(f)
274+
).get(driverContext);
275+
String desc = "RoundToLong2";
276+
if (evaluator.toString().contains(desc) == false) {
277+
throw new IllegalArgumentException("Evaluator was [" + evaluator + "] but expected one containing [" + desc + "]");
278+
}
279+
yield evaluator;
280+
}
281+
case "round_to_3" -> {
282+
FieldAttribute f = longField();
283+
284+
EvalOperator.ExpressionEvaluator evaluator = EvalMapper.toEvaluator(
285+
FOLD_CONTEXT,
286+
new RoundTo(Source.EMPTY, f, List.of(b(), kb(), mb())),
287+
layout(f)
288+
).get(driverContext);
289+
String desc = "RoundToLong3";
290+
if (evaluator.toString().contains(desc) == false) {
291+
throw new IllegalArgumentException("Evaluator was [" + evaluator + "] but expected one containing [" + desc + "]");
292+
}
293+
yield evaluator;
294+
}
295+
case "round_to_4" -> {
296+
FieldAttribute f = longField();
297+
298+
EvalOperator.ExpressionEvaluator evaluator = EvalMapper.toEvaluator(
299+
FOLD_CONTEXT,
300+
new RoundTo(Source.EMPTY, f, List.of(b(), kb(), mb(), gb())),
301+
layout(f)
302+
).get(driverContext);
303+
String desc = "RoundToLong4";
304+
if (evaluator.toString().contains(desc) == false) {
305+
throw new IllegalArgumentException("Evaluator was [" + evaluator + "] but expected one containing [" + desc + "]");
306+
}
307+
yield evaluator;
308+
}
243309
case "to_lower", "to_lower_ords" -> {
244310
FieldAttribute keywordField = keywordField();
245311
ToLower toLower = new ToLower(Source.EMPTY, keywordField, configuration());
@@ -419,6 +485,69 @@ private static void checkExpected(String operation, Page actual) {
419485
}
420486
}
421487
}
488+
case "round_to_4_via_case", "round_to_4" -> {
489+
long b = 1;
490+
long kb = ByteSizeUnit.KB.toBytes(1);
491+
long mb = ByteSizeUnit.MB.toBytes(1);
492+
long gb = ByteSizeUnit.GB.toBytes(1);
493+
494+
LongVector f = actual.<LongBlock>getBlock(0).asVector();
495+
LongVector result = actual.<LongBlock>getBlock(1).asVector();
496+
for (int i = 0; i < BLOCK_LENGTH; i++) {
497+
long expected = f.getLong(i);
498+
if (expected < kb) {
499+
expected = b;
500+
} else if (expected < mb) {
501+
expected = kb;
502+
} else if (expected < gb) {
503+
expected = mb;
504+
} else {
505+
expected = gb;
506+
}
507+
if (result.getLong(i) != expected) {
508+
throw new AssertionError("[" + operation + "] expected [" + expected + "] but was [" + result.getLong(i) + "]");
509+
}
510+
}
511+
}
512+
case "round_to_3" -> {
513+
long b = 1;
514+
long kb = ByteSizeUnit.KB.toBytes(1);
515+
long mb = ByteSizeUnit.MB.toBytes(1);
516+
517+
LongVector f = actual.<LongBlock>getBlock(0).asVector();
518+
LongVector result = actual.<LongBlock>getBlock(1).asVector();
519+
for (int i = 0; i < BLOCK_LENGTH; i++) {
520+
long expected = f.getLong(i);
521+
if (expected < kb) {
522+
expected = b;
523+
} else if (expected < mb) {
524+
expected = kb;
525+
} else {
526+
expected = mb;
527+
}
528+
if (result.getLong(i) != expected) {
529+
throw new AssertionError("[" + operation + "] expected [" + expected + "] but was [" + result.getLong(i) + "]");
530+
}
531+
}
532+
}
533+
case "round_to_2" -> {
534+
long b = 1;
535+
long kb = ByteSizeUnit.KB.toBytes(1);
536+
537+
LongVector f = actual.<LongBlock>getBlock(0).asVector();
538+
LongVector result = actual.<LongBlock>getBlock(1).asVector();
539+
for (int i = 0; i < BLOCK_LENGTH; i++) {
540+
long expected = f.getLong(i);
541+
if (expected < kb) {
542+
expected = b;
543+
} else {
544+
expected = kb;
545+
}
546+
if (result.getLong(i) != expected) {
547+
throw new AssertionError("[" + operation + "] expected [" + expected + "] but was [" + result.getLong(i) + "]");
548+
}
549+
}
550+
}
422551
case "to_lower" -> checkBytes(operation, actual, false, new BytesRef[] { new BytesRef("foo"), new BytesRef("bar") });
423552
case "to_lower_ords" -> checkBytes(operation, actual, true, new BytesRef[] { new BytesRef("foo"), new BytesRef("bar") });
424553
case "to_upper" -> checkBytes(operation, actual, false, new BytesRef[] { new BytesRef("FOO"), new BytesRef("BAR") });
@@ -450,7 +579,7 @@ private static void checkBytes(String operation, Page actual, boolean expectOrds
450579

451580
private static Page page(String operation) {
452581
return switch (operation) {
453-
case "abs", "add", "date_trunc", "equal_to_const" -> {
582+
case "abs", "add", "date_trunc", "equal_to_const", "round_to_4_via_case", "round_to_2", "round_to_3", "round_to_4" -> {
454583
var builder = blockFactory.newLongBlockBuilder(BLOCK_LENGTH);
455584
for (int i = 0; i < BLOCK_LENGTH; i++) {
456585
builder.appendLong(i * 100_000);
@@ -540,6 +669,26 @@ private static Page page(String operation) {
540669
};
541670
}
542671

672+
private static Literal b() {
673+
return lit(1L);
674+
}
675+
676+
private static Literal kb() {
677+
return lit(ByteSizeUnit.KB.toBytes(1));
678+
}
679+
680+
private static Literal mb() {
681+
return lit(ByteSizeUnit.MB.toBytes(1));
682+
}
683+
684+
private static Literal gb() {
685+
return lit(ByteSizeUnit.GB.toBytes(1));
686+
}
687+
688+
private static Literal lit(long v) {
689+
return new Literal(Source.EMPTY, v, DataType.LONG);
690+
}
691+
543692
@Benchmark
544693
@OperationsPerInvocation(1024 * BLOCK_LENGTH)
545694
public void run() {

benchmarks/src/main/java/org/elasticsearch/benchmark/script/ScriptScoreBenchmark.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
3131
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
3232
import org.elasticsearch.index.mapper.MappedFieldType;
33+
import org.elasticsearch.index.mapper.MappingLookup;
3334
import org.elasticsearch.index.mapper.NumberFieldMapper.NumberFieldType;
3435
import org.elasticsearch.index.mapper.NumberFieldMapper.NumberType;
36+
import org.elasticsearch.index.mapper.SourceFieldMetrics;
3537
import org.elasticsearch.indices.breaker.CircuitBreakerService;
3638
import org.elasticsearch.indices.breaker.NoneCircuitBreakerService;
3739
import org.elasticsearch.plugins.PluginsLoader;
@@ -90,7 +92,7 @@ public class ScriptScoreBenchmark {
9092
private final SearchLookup lookup = new SearchLookup(
9193
fieldTypes::get,
9294
(mft, lookup, fdo) -> mft.fielddataBuilder(FieldDataContext.noRuntimeFields("benchmark")).build(fieldDataCache, breakerService),
93-
SourceProvider.fromStoredFields()
95+
SourceProvider.fromLookup(MappingLookup.EMPTY, null, SourceFieldMetrics.NOOP)
9496
);
9597

9698
@Param({ "expression", "metal", "painless_cast", "painless_def" })

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DockerBase.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,27 @@
1414
*/
1515
public enum DockerBase {
1616
// "latest" here is intentional, since the image name specifies "9"
17-
DEFAULT("redhat/ubi9-minimal:latest", "", "microdnf", "Dockerfile.default"),
17+
DEFAULT("redhat/ubi9-minimal:latest", "", "microdnf", "dockerfiles/default/Dockerfile"),
1818

1919
// The Iron Bank base image is UBI (albeit hardened), but we are required to parameterize the Docker build
2020
IRON_BANK("${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}", "-ironbank", "yum", "Dockerfile"),
2121

2222
// Chainguard based wolfi image with latest jdk
23-
// This is usually updated via renovatebot
24-
// spotless:off
2523
WOLFI(
26-
"docker.elastic.co/wolfi/chainguard-base:latest@sha256:29150cd940cc7f69407d978d5a19c86f4d9e67cf44e4d6ded787a497e8f27c9a",
24+
null,
2725
"-wolfi",
2826
"apk",
29-
"Dockerfile"
27+
"dockerfiles/wolfi/Dockerfile"
3028
),
31-
// spotless:on
3229
// Based on WOLFI above, with more extras. We don't set a base image because
3330
// we programmatically extend from the wolfi image.
3431
CLOUD_ESS(null, "-cloud-ess", "apk", "Dockerfile.ess"),
3532

3633
CLOUD_ESS_FIPS(
37-
"docker.elastic.co/wolfi/chainguard-base-fips:sha256-ebfc3f1d7dba992231747a2e05ad1b859843e81b5e676ad342859d7cf9e425a7@sha256:ebfc3f1d7dba992231747a2e05ad1b859843e81b5e676ad342859d7cf9e425a7",
34+
null,
3835
"-cloud-ess-fips",
3936
"apk",
40-
"Dockerfile.ess-fips"
37+
"dockerfiles/cloud_ess_fips/Dockerfile"
4138
);
4239

4340
private final String image;

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/RestTestBasePlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public void apply(Project project) {
165165
nonInputSystemProperties.systemProperty(TESTS_FEATURES_METADATA_PATH, () -> featureMetadataConfig.getAsPath());
166166

167167
// Enable parallel execution for these tests since each test gets its own cluster
168-
task.setMaxParallelForks(task.getProject().getGradle().getStartParameter().getMaxWorkerCount() / 2);
168+
task.setMaxParallelForks(Math.max(1, task.getProject().getGradle().getStartParameter().getMaxWorkerCount() / 2));
169169
nonInputSystemProperties.systemProperty(TESTS_MAX_PARALLEL_FORKS_SYSPROP, () -> String.valueOf(task.getMaxParallelForks()));
170170

171171
// Disable test failure reporting since this stuff is now captured in build scans

build-tools/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ gradlePlugin {
5151
id = 'elasticsearch.stable-esplugin'
5252
implementationClass = 'org.elasticsearch.gradle.plugin.StablePluginBuildPlugin'
5353
}
54+
testBuildInfo {
55+
id = 'elasticsearch.test-build-info'
56+
implementationClass = 'org.elasticsearch.gradle.test.TestBuildInfoPlugin'
57+
}
5458
javaRestTest {
5559
id = 'elasticsearch.java-rest-test'
5660
implementationClass = 'org.elasticsearch.gradle.test.JavaRestTestPlugin'

0 commit comments

Comments
 (0)