Skip to content

Commit cd78510

Browse files
Merge branch 'main' into svilen/multimatch_args
2 parents 32ba25a + 7532ad5 commit cd78510

File tree

670 files changed

+20995
-3098
lines changed

Some content is hidden

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

670 files changed

+20995
-3098
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
steps:
2+
- label: periodic-micro-benchmarks
3+
command: |
4+
.ci/scripts/run-gradle.sh -p benchmarks/ run --args 'org.elasticsearch.benchmark._nightly -rf json -rff build/result.json'
5+
timeout_in_minutes: 300
6+
agents:
7+
provider: gcp
8+
image: family/elasticsearch-ubuntu-2004
9+
machineType: custom-32-98304
10+
buildDirectory: /dev/shm/bk

.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/esql/QueryPlanningBenchmark.java renamed to benchmarks/src/main/java/org/elasticsearch/benchmark/_nightly/esql/QueryPlanningBenchmark.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
package org.elasticsearch.benchmark.esql;
10+
package org.elasticsearch.benchmark._nightly.esql;
1111

1212
import org.elasticsearch.common.logging.LogConfigurator;
1313
import org.elasticsearch.common.settings.Settings;
@@ -67,9 +67,9 @@ public class QueryPlanningBenchmark {
6767
}
6868

6969
private PlanTelemetry telemetry;
70-
private EsqlParser parser;
71-
private Analyzer analyzer;
72-
private LogicalPlanOptimizer optimizer;
70+
private EsqlParser defaultParser;
71+
private Analyzer manyFieldsAnalyzer;
72+
private LogicalPlanOptimizer defaultOptimizer;
7373

7474
@Setup
7575
public void setup() {
@@ -100,8 +100,8 @@ public void setup() {
100100
var functionRegistry = new EsqlFunctionRegistry();
101101

102102
telemetry = new PlanTelemetry(functionRegistry);
103-
parser = new EsqlParser();
104-
analyzer = new Analyzer(
103+
defaultParser = new EsqlParser();
104+
manyFieldsAnalyzer = new Analyzer(
105105
new AnalyzerContext(
106106
config,
107107
functionRegistry,
@@ -112,10 +112,10 @@ public void setup() {
112112
),
113113
new Verifier(new Metrics(functionRegistry), new XPackLicenseState(() -> 0L))
114114
);
115-
optimizer = new LogicalPlanOptimizer(new LogicalOptimizerContext(config, FoldContext.small()));
115+
defaultOptimizer = new LogicalPlanOptimizer(new LogicalOptimizerContext(config, FoldContext.small()));
116116
}
117117

118-
private LogicalPlan plan(String query) {
118+
private LogicalPlan plan(EsqlParser parser, Analyzer analyzer, LogicalPlanOptimizer optimizer, String query) {
119119
var parsed = parser.createStatement(query, new QueryParams(), telemetry);
120120
var analyzed = analyzer.analyze(parsed);
121121
var optimized = optimizer.optimize(analyzed);
@@ -124,6 +124,6 @@ private LogicalPlan plan(String query) {
124124

125125
@Benchmark
126126
public void manyFields(Blackhole blackhole) {
127-
blackhole.consume(plan("FROM test | LIMIT 10"));
127+
blackhole.consume(plan(defaultParser, manyFieldsAnalyzer, defaultOptimizer, "FROM test | LIMIT 10"));
128128
}
129129
}

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/ElasticsearchTestBasePlugin.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ public void execute(Task t) {
120120
"--add-opens=java.base/java.nio.file=ALL-UNNAMED",
121121
"--add-opens=java.base/java.time=ALL-UNNAMED",
122122
"--add-opens=java.management/java.lang.management=ALL-UNNAMED",
123+
"--enable-native-access=ALL-UNNAMED",
123124
"-XX:+HeapDumpOnOutOfMemoryError"
124125
);
125126

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

0 commit comments

Comments
 (0)