From 23e4db85580f966d3a41fe2c8f0fb628707c9297 Mon Sep 17 00:00:00 2001
From: Mikhail Berezovskiy
Date: Tue, 11 Feb 2025 19:29:00 -0800
Subject: [PATCH 01/93] Unmute #122104 & #122103
---
muted-tests.yml | 6 ------
1 file changed, 6 deletions(-)
diff --git a/muted-tests.yml b/muted-tests.yml
index 06e913bd8631..b6401c11ca8c 100644
--- a/muted-tests.yml
+++ b/muted-tests.yml
@@ -372,12 +372,6 @@ tests:
- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
method: test {yaml=snapshot.delete/10_basic/Delete a snapshot asynchronously}
issue: https://github.com/elastic/elasticsearch/issues/122102
-- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
- method: test {yaml=search/180_locale_dependent_mapping/Test Index and Search locale dependent mappings / dates}
- issue: https://github.com/elastic/elasticsearch/issues/122103
-- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
- method: test {yaml=snapshot.delete/10_basic/Delete a snapshot asynchronously}
- issue: https://github.com/elastic/elasticsearch/issues/122104
- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
method: testWithOnlyTrainingRowsAndTrainingPercentIsFifty_DependentVariableIsBoolean
issue: https://github.com/elastic/elasticsearch/issues/121680
From e44e5a3b925cc48f970f2831548ea10fdc05a897 Mon Sep 17 00:00:00 2001
From: elasticsearchmachine
<58790826+elasticsearchmachine@users.noreply.github.com>
Date: Wed, 12 Feb 2025 16:36:36 +1100
Subject: [PATCH 02/93] Mute
org.elasticsearch.xpack.searchablesnapshots.hdfs.HdfsSearchableSnapshotsIT
org.elasticsearch.xpack.searchablesnapshots.hdfs.HdfsSearchableSnapshotsIT
#122024
---
muted-tests.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/muted-tests.yml b/muted-tests.yml
index b6401c11ca8c..3829cda8cafa 100644
--- a/muted-tests.yml
+++ b/muted-tests.yml
@@ -412,6 +412,8 @@ tests:
- class: org.elasticsearch.blocks.SimpleBlocksIT
method: testConcurrentAddBlock
issue: https://github.com/elastic/elasticsearch/issues/122324
+- class: org.elasticsearch.xpack.searchablesnapshots.hdfs.HdfsSearchableSnapshotsIT
+ issue: https://github.com/elastic/elasticsearch/issues/122024
# Examples:
#
From 6d25cbfd7a64749bffa89464e3a5b9edcb6a858e Mon Sep 17 00:00:00 2001
From: elasticsearchmachine
<58790826+elasticsearchmachine@users.noreply.github.com>
Date: Wed, 12 Feb 2025 17:08:45 +1100
Subject: [PATCH 03/93] Mute
org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT test
{yaml=reference/cat/health/cat-health-example} #122335
---
muted-tests.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/muted-tests.yml b/muted-tests.yml
index 3829cda8cafa..be974ca2860f 100644
--- a/muted-tests.yml
+++ b/muted-tests.yml
@@ -414,6 +414,9 @@ tests:
issue: https://github.com/elastic/elasticsearch/issues/122324
- class: org.elasticsearch.xpack.searchablesnapshots.hdfs.HdfsSearchableSnapshotsIT
issue: https://github.com/elastic/elasticsearch/issues/122024
+- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
+ method: test {yaml=reference/cat/health/cat-health-example}
+ issue: https://github.com/elastic/elasticsearch/issues/122335
# Examples:
#
From 9112aba6018dbb4bb0feee7460b8aff34e88846c Mon Sep 17 00:00:00 2001
From: elasticsearchmachine
<58790826+elasticsearchmachine@users.noreply.github.com>
Date: Wed, 12 Feb 2025 17:41:43 +1100
Subject: [PATCH 04/93] Mute
org.elasticsearch.xpack.esql.action.CrossClusterCancellationIT
testCloseSkipUnavailable #122336
---
muted-tests.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/muted-tests.yml b/muted-tests.yml
index be974ca2860f..0090b6fe9008 100644
--- a/muted-tests.yml
+++ b/muted-tests.yml
@@ -417,6 +417,9 @@ tests:
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
method: test {yaml=reference/cat/health/cat-health-example}
issue: https://github.com/elastic/elasticsearch/issues/122335
+- class: org.elasticsearch.xpack.esql.action.CrossClusterCancellationIT
+ method: testCloseSkipUnavailable
+ issue: https://github.com/elastic/elasticsearch/issues/122336
# Examples:
#
From 2b54de1e4bad8db288f487eca7988bff463ff28b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lorenzo=20Dematt=C3=A9?=
Date: Wed, 12 Feb 2025 08:14:36 +0100
Subject: [PATCH 05/93] Skip SM policy parsing and validation for Java24+
(#122233)
---
.../plugins/cli/InstallPluginAction.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/cli/InstallPluginAction.java b/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/cli/InstallPluginAction.java
index f4601d70a7f0..0803d24c3914 100644
--- a/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/cli/InstallPluginAction.java
+++ b/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/cli/InstallPluginAction.java
@@ -38,6 +38,7 @@ import org.elasticsearch.core.SuppressForbidden;
import org.elasticsearch.core.Tuple;
import org.elasticsearch.env.Environment;
import org.elasticsearch.jdk.JarHell;
+import org.elasticsearch.jdk.RuntimeVersionFeature;
import org.elasticsearch.plugin.scanner.ClassReaders;
import org.elasticsearch.plugin.scanner.NamedComponentScanner;
import org.elasticsearch.plugins.Platforms;
@@ -922,10 +923,12 @@ public class InstallPluginAction implements Closeable {
*/
private PluginDescriptor installPlugin(InstallablePlugin descriptor, Path tmpRoot, List deleteOnFailure) throws Exception {
final PluginDescriptor info = loadPluginInfo(tmpRoot);
- PluginPolicyInfo pluginPolicy = PolicyUtil.getPluginPolicyInfo(tmpRoot, env.tmpDir());
- if (pluginPolicy != null) {
- Set permissions = PluginSecurity.getPermissionDescriptions(pluginPolicy, env.tmpDir());
- PluginSecurity.confirmPolicyExceptions(terminal, permissions, batch);
+ if (RuntimeVersionFeature.isSecurityManagerAvailable()) {
+ PluginPolicyInfo pluginPolicy = PolicyUtil.getPluginPolicyInfo(tmpRoot, env.tmpDir());
+ if (pluginPolicy != null) {
+ Set permissions = PluginSecurity.getPermissionDescriptions(pluginPolicy, env.tmpDir());
+ PluginSecurity.confirmPolicyExceptions(terminal, permissions, batch);
+ }
}
// Validate that the downloaded plugin's ID matches what we expect from the descriptor. The
From a0029cd83329c6279684258f1c7ba5bd0963424c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Francisco=20Fern=C3=A1ndez=20Casta=C3=B1o?=
Date: Wed, 12 Feb 2025 09:16:42 +0100
Subject: [PATCH 06/93] Ensure that IndexShard is mutable before force merges
(#122275)
Closes ES-10787
---
.../forcemerge/TransportForceMergeAction.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/forcemerge/TransportForceMergeAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/forcemerge/TransportForceMergeAction.java
index da08b78d711c..7a866792d167 100644
--- a/server/src/main/java/org/elasticsearch/action/admin/indices/forcemerge/TransportForceMergeAction.java
+++ b/server/src/main/java/org/elasticsearch/action/admin/indices/forcemerge/TransportForceMergeAction.java
@@ -12,6 +12,7 @@ package org.elasticsearch.action.admin.indices.forcemerge;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRunnable;
import org.elasticsearch.action.support.ActionFilters;
+import org.elasticsearch.action.support.SubscribableListener;
import org.elasticsearch.action.support.broadcast.BroadcastResponse;
import org.elasticsearch.action.support.broadcast.node.TransportBroadcastByNodeAction;
import org.elasticsearch.cluster.ClusterState;
@@ -92,12 +93,16 @@ public class TransportForceMergeAction extends TransportBroadcastByNodeAction<
ActionListener listener
) {
assert (task instanceof CancellableTask) == false; // TODO: add cancellation handling here once the task supports it
- threadPool.executor(ThreadPool.Names.FORCE_MERGE).execute(ActionRunnable.supply(listener, () -> {
+ SubscribableListener.newForked(l -> {
IndexShard indexShard = indicesService.indexServiceSafe(shardRouting.shardId().getIndex())
.getShard(shardRouting.shardId().id());
- indexShard.forceMerge(request);
- return EmptyResult.INSTANCE;
- }));
+ indexShard.ensureMutable(l.map(unused -> indexShard));
+ }).andThen((l, indexShard) -> {
+ threadPool.executor(ThreadPool.Names.FORCE_MERGE).execute(ActionRunnable.supply(l, () -> {
+ indexShard.forceMerge(request);
+ return EmptyResult.INSTANCE;
+ }));
+ }).addListener(listener);
}
/**
From a57b985487955886769375eaf9a69a2d9b5b3c80 Mon Sep 17 00:00:00 2001
From: Ievgen Degtiarenko
Date: Wed, 12 Feb 2025 09:17:15 +0100
Subject: [PATCH 07/93] Enforce aggs interface (#121898)
---
.../compute/gen/AggregatorImplementer.java | 3 +--
.../compute/gen/GroupingAggregatorImplementer.java | 3 +--
.../java/org/elasticsearch/compute/gen/Types.java | 3 +++
.../compute/aggregation/RateDoubleAggregator.java | 3 ++-
.../compute/aggregation/RateFloatAggregator.java | 3 ++-
.../compute/aggregation/RateIntAggregator.java | 3 ++-
.../compute/aggregation/RateLongAggregator.java | 3 ++-
.../compute/aggregation/TopBooleanAggregator.java | 14 ++++++++------
.../compute/aggregation/TopBytesRefAggregator.java | 14 ++++++++------
.../compute/aggregation/TopDoubleAggregator.java | 14 ++++++++------
.../compute/aggregation/TopFloatAggregator.java | 14 ++++++++------
.../compute/aggregation/TopIntAggregator.java | 14 ++++++++------
.../compute/aggregation/TopIpAggregator.java | 14 ++++++++------
.../compute/aggregation/TopLongAggregator.java | 14 ++++++++------
.../aggregation/ValuesBytesRefAggregator.java | 14 ++++++++------
.../aggregation/ValuesDoubleAggregator.java | 14 ++++++++------
.../compute/aggregation/ValuesFloatAggregator.java | 14 ++++++++------
.../compute/aggregation/ValuesIntAggregator.java | 14 ++++++++------
.../compute/aggregation/ValuesLongAggregator.java | 14 ++++++++------
.../compute/aggregation/AbstractArrayState.java | 1 +
.../compute/aggregation/BytesRefArrayState.java | 3 ++-
.../aggregation/GroupingAggregatorState.java | 1 +
.../compute/aggregation/HllStates.java | 3 ++-
.../compute/aggregation/MaxBytesRefAggregator.java | 14 ++++++++------
.../compute/aggregation/MaxIpAggregator.java | 14 ++++++++------
.../compute/aggregation/MinBytesRefAggregator.java | 14 ++++++++------
.../compute/aggregation/MinIpAggregator.java | 14 ++++++++------
.../compute/aggregation/QuantileStates.java | 3 ++-
.../compute/aggregation/StdDevStates.java | 3 ++-
.../aggregation/ValuesBooleanAggregator.java | 14 ++++++++------
.../compute/aggregation/X-RateAggregator.java.st | 3 ++-
.../compute/aggregation/X-TopAggregator.java.st | 14 ++++++++------
.../compute/aggregation/X-ValuesAggregator.java.st | 14 ++++++++------
.../spatial/CentroidPointAggregator.java | 3 ++-
34 files changed, 179 insertions(+), 128 deletions(-)
diff --git a/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/AggregatorImplementer.java b/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/AggregatorImplementer.java
index 8a02f8bc4c69..d775a4610921 100644
--- a/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/AggregatorImplementer.java
+++ b/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/AggregatorImplementer.java
@@ -95,8 +95,7 @@ public class AggregatorImplementer {
this.init = requireStaticMethod(
declarationType,
- // This should be more restrictive and require org.elasticsearch.compute.aggregation.AggregatorState
- requirePrimitiveOrImplements(elements, Types.RELEASABLE),
+ requirePrimitiveOrImplements(elements, Types.AGGREGATOR_STATE),
requireName("init", "initSingle"),
requireAnyArgs("")
);
diff --git a/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/GroupingAggregatorImplementer.java b/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/GroupingAggregatorImplementer.java
index fc377f22bbbc..d2b6a0e01168 100644
--- a/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/GroupingAggregatorImplementer.java
+++ b/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/GroupingAggregatorImplementer.java
@@ -99,8 +99,7 @@ public class GroupingAggregatorImplementer {
this.init = requireStaticMethod(
declarationType,
- // This should be more restrictive and require org.elasticsearch.compute.aggregation.GroupingAggregatorState
- requirePrimitiveOrImplements(elements, Types.RELEASABLE),
+ requirePrimitiveOrImplements(elements, Types.GROUPING_AGGREGATOR_STATE),
requireName("init", "initGrouping"),
requireAnyArgs("")
);
diff --git a/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/Types.java b/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/Types.java
index fcd9c64be767..35c42153f9ad 100644
--- a/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/Types.java
+++ b/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/Types.java
@@ -79,6 +79,9 @@ public class Types {
static final ClassName DOUBLE_VECTOR_FIXED_BUILDER = ClassName.get(DATA_PACKAGE, "DoubleVector", "FixedBuilder");
static final ClassName FLOAT_VECTOR_FIXED_BUILDER = ClassName.get(DATA_PACKAGE, "FloatVector", "FixedBuilder");
+ static final ClassName AGGREGATOR_STATE = ClassName.get(AGGREGATION_PACKAGE, "AggregatorState");
+ static final ClassName GROUPING_AGGREGATOR_STATE = ClassName.get(AGGREGATION_PACKAGE, "GroupingAggregatorState");
+
static final ClassName AGGREGATOR_FUNCTION = ClassName.get(AGGREGATION_PACKAGE, "AggregatorFunction");
static final ClassName AGGREGATOR_FUNCTION_SUPPLIER = ClassName.get(AGGREGATION_PACKAGE, "AggregatorFunctionSupplier");
static final ClassName GROUPING_AGGREGATOR_FUNCTION = ClassName.get(AGGREGATION_PACKAGE, "GroupingAggregatorFunction");
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateDoubleAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateDoubleAggregator.java
index cbd20f15c651..deec1ef04f62 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateDoubleAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateDoubleAggregator.java
@@ -333,7 +333,8 @@ public class RateDoubleAggregator {
}
}
- void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
// noop - we handle the null states inside `toIntermediate` and `evaluateFinal`
}
}
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateFloatAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateFloatAggregator.java
index b50b125d9833..94ad5254bc72 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateFloatAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateFloatAggregator.java
@@ -334,7 +334,8 @@ public class RateFloatAggregator {
}
}
- void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
// noop - we handle the null states inside `toIntermediate` and `evaluateFinal`
}
}
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateIntAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateIntAggregator.java
index 01c3e3d7fb8e..011291dd08c5 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateIntAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateIntAggregator.java
@@ -334,7 +334,8 @@ public class RateIntAggregator {
}
}
- void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
// noop - we handle the null states inside `toIntermediate` and `evaluateFinal`
}
}
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateLongAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateLongAggregator.java
index c84985b703ae..9ccb5d3bd1b1 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateLongAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/RateLongAggregator.java
@@ -333,7 +333,8 @@ public class RateLongAggregator {
}
}
- void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
// noop - we handle the null states inside `toIntermediate` and `evaluateFinal`
}
}
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopBooleanAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopBooleanAggregator.java
index 32391c482730..a2e86b3b0934 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopBooleanAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopBooleanAggregator.java
@@ -17,7 +17,6 @@ import org.elasticsearch.compute.data.BooleanBlock;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.data.sort.BooleanBucketedSort;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
import org.elasticsearch.search.sort.SortOrder;
@@ -74,7 +73,7 @@ class TopBooleanAggregator {
return state.toBlock(driverContext.blockFactory(), selected);
}
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final BooleanBucketedSort sort;
private GroupingState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -89,7 +88,8 @@ class TopBooleanAggregator {
sort.merge(groupId, other.sort, otherGroupId);
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory(), selected);
}
@@ -97,7 +97,8 @@ class TopBooleanAggregator {
return sort.toBlock(blockFactory, selected);
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
// we figure out seen values from nulls on the values block
}
@@ -107,7 +108,7 @@ class TopBooleanAggregator {
}
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final GroupingState internalState;
private SingleState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -122,7 +123,8 @@ class TopBooleanAggregator {
internalState.merge(0, other, 0);
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory());
}
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopBytesRefAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopBytesRefAggregator.java
index c9b0e679b3e6..0a965899c077 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopBytesRefAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopBytesRefAggregator.java
@@ -19,7 +19,6 @@ import org.elasticsearch.compute.data.BytesRefBlock;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.data.sort.BytesRefBucketedSort;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
import org.elasticsearch.search.sort.SortOrder;
@@ -78,7 +77,7 @@ class TopBytesRefAggregator {
return state.toBlock(driverContext.blockFactory(), selected);
}
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final BytesRefBucketedSort sort;
private GroupingState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -95,7 +94,8 @@ class TopBytesRefAggregator {
sort.merge(groupId, other.sort, otherGroupId);
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory(), selected);
}
@@ -103,7 +103,8 @@ class TopBytesRefAggregator {
return sort.toBlock(blockFactory, selected);
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
// we figure out seen values from nulls on the values block
}
@@ -113,7 +114,7 @@ class TopBytesRefAggregator {
}
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final GroupingState internalState;
private SingleState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -128,7 +129,8 @@ class TopBytesRefAggregator {
internalState.merge(0, other, 0);
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory());
}
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopDoubleAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopDoubleAggregator.java
index d9a7a302f07c..6a20ed99bc23 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopDoubleAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopDoubleAggregator.java
@@ -17,7 +17,6 @@ import org.elasticsearch.compute.data.DoubleBlock;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.data.sort.DoubleBucketedSort;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
import org.elasticsearch.search.sort.SortOrder;
@@ -74,7 +73,7 @@ class TopDoubleAggregator {
return state.toBlock(driverContext.blockFactory(), selected);
}
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final DoubleBucketedSort sort;
private GroupingState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -89,7 +88,8 @@ class TopDoubleAggregator {
sort.merge(groupId, other.sort, otherGroupId);
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory(), selected);
}
@@ -97,7 +97,8 @@ class TopDoubleAggregator {
return sort.toBlock(blockFactory, selected);
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
// we figure out seen values from nulls on the values block
}
@@ -107,7 +108,7 @@ class TopDoubleAggregator {
}
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final GroupingState internalState;
private SingleState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -122,7 +123,8 @@ class TopDoubleAggregator {
internalState.merge(0, other, 0);
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory());
}
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopFloatAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopFloatAggregator.java
index 8b65261e10f4..cf6ad0f9017d 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopFloatAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopFloatAggregator.java
@@ -17,7 +17,6 @@ import org.elasticsearch.compute.data.FloatBlock;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.data.sort.FloatBucketedSort;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
import org.elasticsearch.search.sort.SortOrder;
@@ -74,7 +73,7 @@ class TopFloatAggregator {
return state.toBlock(driverContext.blockFactory(), selected);
}
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final FloatBucketedSort sort;
private GroupingState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -89,7 +88,8 @@ class TopFloatAggregator {
sort.merge(groupId, other.sort, otherGroupId);
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory(), selected);
}
@@ -97,7 +97,8 @@ class TopFloatAggregator {
return sort.toBlock(blockFactory, selected);
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
// we figure out seen values from nulls on the values block
}
@@ -107,7 +108,7 @@ class TopFloatAggregator {
}
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final GroupingState internalState;
private SingleState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -122,7 +123,8 @@ class TopFloatAggregator {
internalState.merge(0, other, 0);
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory());
}
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopIntAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopIntAggregator.java
index 5c6b79f710af..f4ac83c43806 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopIntAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopIntAggregator.java
@@ -17,7 +17,6 @@ import org.elasticsearch.compute.data.IntBlock;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.data.sort.IntBucketedSort;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
import org.elasticsearch.search.sort.SortOrder;
@@ -74,7 +73,7 @@ class TopIntAggregator {
return state.toBlock(driverContext.blockFactory(), selected);
}
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final IntBucketedSort sort;
private GroupingState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -89,7 +88,8 @@ class TopIntAggregator {
sort.merge(groupId, other.sort, otherGroupId);
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory(), selected);
}
@@ -97,7 +97,8 @@ class TopIntAggregator {
return sort.toBlock(blockFactory, selected);
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
// we figure out seen values from nulls on the values block
}
@@ -107,7 +108,7 @@ class TopIntAggregator {
}
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final GroupingState internalState;
private SingleState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -122,7 +123,8 @@ class TopIntAggregator {
internalState.merge(0, other, 0);
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory());
}
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopIpAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopIpAggregator.java
index 219f7385b56d..292dd539edeb 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopIpAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopIpAggregator.java
@@ -18,7 +18,6 @@ import org.elasticsearch.compute.data.BytesRefBlock;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.data.sort.IpBucketedSort;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
import org.elasticsearch.search.sort.SortOrder;
@@ -77,7 +76,7 @@ class TopIpAggregator {
return state.toBlock(driverContext.blockFactory(), selected);
}
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final IpBucketedSort sort;
private GroupingState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -92,7 +91,8 @@ class TopIpAggregator {
sort.merge(groupId, other.sort, otherGroupId);
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory(), selected);
}
@@ -100,7 +100,8 @@ class TopIpAggregator {
return sort.toBlock(blockFactory, selected);
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
// we figure out seen values from nulls on the values block
}
@@ -110,7 +111,7 @@ class TopIpAggregator {
}
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final GroupingState internalState;
private SingleState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -125,7 +126,8 @@ class TopIpAggregator {
internalState.merge(0, other, 0);
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory());
}
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopLongAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopLongAggregator.java
index 44cef8df7257..c5af92956bec 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopLongAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopLongAggregator.java
@@ -17,7 +17,6 @@ import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.data.LongBlock;
import org.elasticsearch.compute.data.sort.LongBucketedSort;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
import org.elasticsearch.search.sort.SortOrder;
@@ -74,7 +73,7 @@ class TopLongAggregator {
return state.toBlock(driverContext.blockFactory(), selected);
}
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final LongBucketedSort sort;
private GroupingState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -89,7 +88,8 @@ class TopLongAggregator {
sort.merge(groupId, other.sort, otherGroupId);
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory(), selected);
}
@@ -97,7 +97,8 @@ class TopLongAggregator {
return sort.toBlock(blockFactory, selected);
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
// we figure out seen values from nulls on the values block
}
@@ -107,7 +108,7 @@ class TopLongAggregator {
}
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final GroupingState internalState;
private SingleState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -122,7 +123,8 @@ class TopLongAggregator {
internalState.merge(0, other, 0);
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory());
}
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesBytesRefAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesBytesRefAggregator.java
index bd77bd7ff1e4..ad0ab2f7189f 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesBytesRefAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesBytesRefAggregator.java
@@ -20,7 +20,6 @@ import org.elasticsearch.compute.data.BlockFactory;
import org.elasticsearch.compute.data.BytesRefBlock;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
/**
@@ -83,14 +82,15 @@ class ValuesBytesRefAggregator {
return state.toBlock(driverContext.blockFactory(), selected);
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final BytesRefHash values;
private SingleState(BigArrays bigArrays) {
values = new BytesRefHash(1, bigArrays);
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory());
}
@@ -125,7 +125,7 @@ class ValuesBytesRefAggregator {
* an {@code O(n^2)} operation for collection to support a {@code O(1)}
* collector operation. But at least it's fairly simple.
*/
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final LongLongHash values;
private final BytesRefHash bytes;
@@ -146,7 +146,8 @@ class ValuesBytesRefAggregator {
}
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory(), selected);
}
@@ -190,7 +191,8 @@ class ValuesBytesRefAggregator {
}
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
// we figure out seen values from nulls on the values block
}
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesDoubleAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesDoubleAggregator.java
index a8409367bc09..271d7120092c 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesDoubleAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesDoubleAggregator.java
@@ -18,7 +18,6 @@ import org.elasticsearch.compute.data.BlockFactory;
import org.elasticsearch.compute.data.DoubleBlock;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
/**
* Aggregates field values for double.
@@ -77,14 +76,15 @@ class ValuesDoubleAggregator {
return state.toBlock(driverContext.blockFactory(), selected);
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final LongHash values;
private SingleState(BigArrays bigArrays) {
values = new LongHash(1, bigArrays);
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory());
}
@@ -118,14 +118,15 @@ class ValuesDoubleAggregator {
* an {@code O(n^2)} operation for collection to support a {@code O(1)}
* collector operation. But at least it's fairly simple.
*/
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final LongLongHash values;
private GroupingState(BigArrays bigArrays) {
values = new LongLongHash(1, bigArrays);
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory(), selected);
}
@@ -168,7 +169,8 @@ class ValuesDoubleAggregator {
}
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
// we figure out seen values from nulls on the values block
}
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesFloatAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesFloatAggregator.java
index f9e5e1b7b283..b44cad807fba 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesFloatAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesFloatAggregator.java
@@ -17,7 +17,6 @@ import org.elasticsearch.compute.data.BlockFactory;
import org.elasticsearch.compute.data.FloatBlock;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
/**
* Aggregates field values for float.
@@ -82,14 +81,15 @@ class ValuesFloatAggregator {
return state.toBlock(driverContext.blockFactory(), selected);
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final LongHash values;
private SingleState(BigArrays bigArrays) {
values = new LongHash(1, bigArrays);
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory());
}
@@ -123,14 +123,15 @@ class ValuesFloatAggregator {
* an {@code O(n^2)} operation for collection to support a {@code O(1)}
* collector operation. But at least it's fairly simple.
*/
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final LongHash values;
private GroupingState(BigArrays bigArrays) {
values = new LongHash(1, bigArrays);
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory(), selected);
}
@@ -175,7 +176,8 @@ class ValuesFloatAggregator {
}
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
// we figure out seen values from nulls on the values block
}
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesIntAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesIntAggregator.java
index 2420dcee7071..4d0c51824569 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesIntAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesIntAggregator.java
@@ -17,7 +17,6 @@ import org.elasticsearch.compute.data.BlockFactory;
import org.elasticsearch.compute.data.IntBlock;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
/**
* Aggregates field values for int.
@@ -82,14 +81,15 @@ class ValuesIntAggregator {
return state.toBlock(driverContext.blockFactory(), selected);
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final LongHash values;
private SingleState(BigArrays bigArrays) {
values = new LongHash(1, bigArrays);
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory());
}
@@ -123,14 +123,15 @@ class ValuesIntAggregator {
* an {@code O(n^2)} operation for collection to support a {@code O(1)}
* collector operation. But at least it's fairly simple.
*/
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final LongHash values;
private GroupingState(BigArrays bigArrays) {
values = new LongHash(1, bigArrays);
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory(), selected);
}
@@ -175,7 +176,8 @@ class ValuesIntAggregator {
}
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
// we figure out seen values from nulls on the values block
}
diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesLongAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesLongAggregator.java
index 4938b8f15edb..5471c90147ec 100644
--- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesLongAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesLongAggregator.java
@@ -18,7 +18,6 @@ import org.elasticsearch.compute.data.BlockFactory;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.data.LongBlock;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
/**
* Aggregates field values for long.
@@ -77,14 +76,15 @@ class ValuesLongAggregator {
return state.toBlock(driverContext.blockFactory(), selected);
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final LongHash values;
private SingleState(BigArrays bigArrays) {
values = new LongHash(1, bigArrays);
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory());
}
@@ -118,14 +118,15 @@ class ValuesLongAggregator {
* an {@code O(n^2)} operation for collection to support a {@code O(1)}
* collector operation. But at least it's fairly simple.
*/
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final LongLongHash values;
private GroupingState(BigArrays bigArrays) {
values = new LongLongHash(1, bigArrays);
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory(), selected);
}
@@ -168,7 +169,8 @@ class ValuesLongAggregator {
}
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
// we figure out seen values from nulls on the values block
}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/AbstractArrayState.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/AbstractArrayState.java
index 5fa1394e8cf9..9886e0c1af30 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/AbstractArrayState.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/AbstractArrayState.java
@@ -37,6 +37,7 @@ public abstract class AbstractArrayState implements Releasable, GroupingAggregat
* idempotent and fast if already tracking so it's safe to, say, call it once
* for every block of values that arrives containing {@code null}.
*/
+ @Override
public final void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
if (seen == null) {
seen = seenGroupIds.seenGroupIds(bigArrays);
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/BytesRefArrayState.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/BytesRefArrayState.java
index eb0a992c8610..18b92c544707 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/BytesRefArrayState.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/BytesRefArrayState.java
@@ -138,7 +138,8 @@ public final class BytesRefArrayState implements GroupingAggregatorState, Releas
* stores a flag to know if optimizations can be made.
*
*/
- void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
this.groupIdTrackingEnabled = true;
}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/GroupingAggregatorState.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/GroupingAggregatorState.java
index 7c644342598d..0e6516466580 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/GroupingAggregatorState.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/GroupingAggregatorState.java
@@ -17,4 +17,5 @@ public interface GroupingAggregatorState extends Releasable {
/** Extracts an intermediate view of the contents of this state. */
void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext);
+ void enableGroupIdTracking(SeenGroupIds seenGroupIds);
}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/HllStates.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/HllStates.java
index 3d8d04d7dc7e..64a970c2acc0 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/HllStates.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/HllStates.java
@@ -138,7 +138,8 @@ final class HllStates {
this.hll = new HyperLogLogPlusPlus(HyperLogLogPlusPlus.precisionFromThreshold(precision), bigArrays, 1);
}
- void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
// Nothing to do
}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MaxBytesRefAggregator.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MaxBytesRefAggregator.java
index 144214f93571..049642c35091 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MaxBytesRefAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MaxBytesRefAggregator.java
@@ -17,7 +17,6 @@ import org.elasticsearch.compute.data.Block;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.operator.BreakingBytesRefBuilder;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
/**
@@ -71,7 +70,7 @@ class MaxBytesRefAggregator {
return state.toBlock(selected, driverContext);
}
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final BytesRefArrayState internalState;
private GroupingState(BigArrays bigArrays, CircuitBreaker breaker) {
@@ -90,7 +89,8 @@ class MaxBytesRefAggregator {
}
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
internalState.toIntermediate(blocks, offset, selected, driverContext);
}
@@ -98,7 +98,8 @@ class MaxBytesRefAggregator {
return internalState.toValuesBlock(selected, driverContext);
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
internalState.enableGroupIdTracking(seen);
}
@@ -108,7 +109,7 @@ class MaxBytesRefAggregator {
}
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final BreakingBytesRefBuilder internalState;
private boolean seen;
@@ -128,7 +129,8 @@ class MaxBytesRefAggregator {
}
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = driverContext.blockFactory().newConstantBytesRefBlockWith(internalState.bytesRefView(), 1);
blocks[offset + 1] = driverContext.blockFactory().newConstantBooleanBlockWith(seen, 1);
}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MaxIpAggregator.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MaxIpAggregator.java
index 1ddce7674ae7..43b4a4a2fe0a 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MaxIpAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MaxIpAggregator.java
@@ -15,7 +15,6 @@ import org.elasticsearch.compute.ann.IntermediateState;
import org.elasticsearch.compute.data.Block;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
@Aggregator({ @IntermediateState(name = "max", type = "BYTES_REF"), @IntermediateState(name = "seen", type = "BOOLEAN") })
@@ -67,7 +66,7 @@ class MaxIpAggregator {
return state.toBlock(selected, driverContext);
}
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final BytesRef scratch = new BytesRef();
private final IpArrayState internalState;
@@ -87,7 +86,8 @@ class MaxIpAggregator {
}
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
internalState.toIntermediate(blocks, offset, selected, driverContext);
}
@@ -95,7 +95,8 @@ class MaxIpAggregator {
return internalState.toValuesBlock(selected, driverContext);
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
internalState.enableGroupIdTracking(seen);
}
@@ -105,7 +106,7 @@ class MaxIpAggregator {
}
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final BytesRef internalState;
private boolean seen;
@@ -121,7 +122,8 @@ class MaxIpAggregator {
}
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = driverContext.blockFactory().newConstantBytesRefBlockWith(internalState, 1);
blocks[offset + 1] = driverContext.blockFactory().newConstantBooleanBlockWith(seen, 1);
}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MinBytesRefAggregator.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MinBytesRefAggregator.java
index 830900702a37..677b38a9af3a 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MinBytesRefAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MinBytesRefAggregator.java
@@ -17,7 +17,6 @@ import org.elasticsearch.compute.data.Block;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.operator.BreakingBytesRefBuilder;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
/**
@@ -71,7 +70,7 @@ class MinBytesRefAggregator {
return state.toBlock(selected, driverContext);
}
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final BytesRefArrayState internalState;
private GroupingState(BigArrays bigArrays, CircuitBreaker breaker) {
@@ -90,7 +89,8 @@ class MinBytesRefAggregator {
}
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
internalState.toIntermediate(blocks, offset, selected, driverContext);
}
@@ -98,7 +98,8 @@ class MinBytesRefAggregator {
return internalState.toValuesBlock(selected, driverContext);
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
internalState.enableGroupIdTracking(seen);
}
@@ -108,7 +109,7 @@ class MinBytesRefAggregator {
}
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final BreakingBytesRefBuilder internalState;
private boolean seen;
@@ -128,7 +129,8 @@ class MinBytesRefAggregator {
}
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = driverContext.blockFactory().newConstantBytesRefBlockWith(internalState.bytesRefView(), 1);
blocks[offset + 1] = driverContext.blockFactory().newConstantBooleanBlockWith(seen, 1);
}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MinIpAggregator.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MinIpAggregator.java
index 8313756851c1..c4ee93db89cf 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MinIpAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/MinIpAggregator.java
@@ -15,7 +15,6 @@ import org.elasticsearch.compute.ann.IntermediateState;
import org.elasticsearch.compute.data.Block;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
@Aggregator({ @IntermediateState(name = "max", type = "BYTES_REF"), @IntermediateState(name = "seen", type = "BOOLEAN") })
@@ -67,7 +66,7 @@ class MinIpAggregator {
return state.toBlock(selected, driverContext);
}
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final BytesRef scratch = new BytesRef();
private final IpArrayState internalState;
@@ -87,7 +86,8 @@ class MinIpAggregator {
}
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
internalState.toIntermediate(blocks, offset, selected, driverContext);
}
@@ -95,7 +95,8 @@ class MinIpAggregator {
return internalState.toValuesBlock(selected, driverContext);
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
internalState.enableGroupIdTracking(seen);
}
@@ -105,7 +106,7 @@ class MinIpAggregator {
}
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final BytesRef internalState;
private boolean seen;
@@ -121,7 +122,8 @@ class MinIpAggregator {
}
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = driverContext.blockFactory().newConstantBytesRefBlockWith(internalState, 1);
blocks[offset + 1] = driverContext.blockFactory().newConstantBooleanBlockWith(seen, 1);
}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/QuantileStates.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/QuantileStates.java
index 329e798dcb3f..d5ea72ed23e5 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/QuantileStates.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/QuantileStates.java
@@ -146,7 +146,8 @@ public final class QuantileStates {
}
}
- void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
// We always enable.
}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/StdDevStates.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/StdDevStates.java
index bff8903fd3be..5b48498d8329 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/StdDevStates.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/StdDevStates.java
@@ -204,7 +204,8 @@ public final class StdDevStates {
Releasables.close(states);
}
- void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
// noop - we handle the null states inside `toIntermediate` and `evaluateFinal`
}
}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/ValuesBooleanAggregator.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/ValuesBooleanAggregator.java
index 252436ad9634..e19d3107172e 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/ValuesBooleanAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/ValuesBooleanAggregator.java
@@ -17,7 +17,6 @@ import org.elasticsearch.compute.data.BlockFactory;
import org.elasticsearch.compute.data.BooleanBlock;
import org.elasticsearch.compute.data.IntVector;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
/**
@@ -84,11 +83,12 @@ class ValuesBooleanAggregator {
return state.toBlock(driverContext.blockFactory(), selected);
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private boolean seenFalse;
private boolean seenTrue;
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory());
}
@@ -113,14 +113,15 @@ class ValuesBooleanAggregator {
public void close() {}
}
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final BitArray values;
private GroupingState(BigArrays bigArrays) {
values = new BitArray(1, bigArrays);
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory(), selected);
}
@@ -155,7 +156,8 @@ class ValuesBooleanAggregator {
}
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
// we don't need to track which values have been seen because we don't do anything special for groups without values
}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-RateAggregator.java.st b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-RateAggregator.java.st
index 2581d3ebbf80..a0b4ed8bd633 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-RateAggregator.java.st
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-RateAggregator.java.st
@@ -338,7 +338,8 @@ public class Rate$Type$Aggregator {
}
}
- void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seenGroupIds) {
// noop - we handle the null states inside `toIntermediate` and `evaluateFinal`
}
}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-TopAggregator.java.st b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-TopAggregator.java.st
index 18d573eea4a4..761b70791e94 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-TopAggregator.java.st
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-TopAggregator.java.st
@@ -28,7 +28,6 @@ import org.elasticsearch.compute.data.$Type$Block;
$endif$
import org.elasticsearch.compute.data.sort.$Name$BucketedSort;
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
import org.elasticsearch.core.Releasables;
import org.elasticsearch.search.sort.SortOrder;
@@ -99,7 +98,7 @@ $endif$
return state.toBlock(driverContext.blockFactory(), selected);
}
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
private final $Name$BucketedSort sort;
private GroupingState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -120,7 +119,8 @@ $endif$
sort.merge(groupId, other.sort, otherGroupId);
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory(), selected);
}
@@ -128,7 +128,8 @@ $endif$
return sort.toBlock(blockFactory, selected);
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
// we figure out seen values from nulls on the values block
}
@@ -138,7 +139,7 @@ $endif$
}
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
private final GroupingState internalState;
private SingleState(BigArrays bigArrays, int limit, boolean ascending) {
@@ -153,7 +154,8 @@ $endif$
internalState.merge(0, other, 0);
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory());
}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-ValuesAggregator.java.st b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-ValuesAggregator.java.st
index 1cef234b2238..3006af595be1 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-ValuesAggregator.java.st
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-ValuesAggregator.java.st
@@ -35,7 +35,6 @@ $if(long)$
import org.elasticsearch.compute.data.LongBlock;
$endif$
import org.elasticsearch.compute.operator.DriverContext;
-import org.elasticsearch.core.Releasable;
$if(BytesRef)$
import org.elasticsearch.core.Releasables;
@@ -155,7 +154,7 @@ $endif$
return state.toBlock(driverContext.blockFactory(), selected);
}
- public static class SingleState implements Releasable {
+ public static class SingleState implements AggregatorState {
$if(BytesRef)$
private final BytesRefHash values;
@@ -171,7 +170,8 @@ $else$
$endif$
}
- void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory());
}
@@ -228,7 +228,7 @@ $endif$
* an {@code O(n^2)} operation for collection to support a {@code O(1)}
* collector operation. But at least it's fairly simple.
*/
- public static class GroupingState implements Releasable {
+ public static class GroupingState implements GroupingAggregatorState {
$if(long||double)$
private final LongLongHash values;
@@ -263,7 +263,8 @@ $elseif(int||float)$
$endif$
}
- void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ @Override
+ public void toIntermediate(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
blocks[offset] = toBlock(driverContext.blockFactory(), selected);
}
@@ -324,7 +325,8 @@ $endif$
}
}
- void enableGroupIdTracking(SeenGroupIds seen) {
+ @Override
+ public void enableGroupIdTracking(SeenGroupIds seen) {
// we figure out seen values from nulls on the values block
}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/spatial/CentroidPointAggregator.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/spatial/CentroidPointAggregator.java
index 47d927fda91b..c3b07d069cf1 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/spatial/CentroidPointAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/spatial/CentroidPointAggregator.java
@@ -260,7 +260,8 @@ abstract class CentroidPointAggregator {
}
/** Needed for generated code that does null tracking, which we do not need because we use count */
- final void enableGroupIdTracking(SeenGroupIds ignore) {}
+ @Override
+ public final void enableGroupIdTracking(SeenGroupIds ignore) {}
private void ensureCapacity(int groupId) {
if (groupId >= xValues.size()) {
From bc6731b4672fb2f083476b0fea8b090458f0a09b Mon Sep 17 00:00:00 2001
From: elasticsearchmachine
<58790826+elasticsearchmachine@users.noreply.github.com>
Date: Wed, 12 Feb 2025 20:00:49 +1100
Subject: [PATCH 08/93] Mute
org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT
testUnsupportedTypesOrdinalGrouping #122342
---
muted-tests.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/muted-tests.yml b/muted-tests.yml
index 0090b6fe9008..6b2546cebc88 100644
--- a/muted-tests.yml
+++ b/muted-tests.yml
@@ -420,6 +420,9 @@ tests:
- class: org.elasticsearch.xpack.esql.action.CrossClusterCancellationIT
method: testCloseSkipUnavailable
issue: https://github.com/elastic/elasticsearch/issues/122336
+- class: org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT
+ method: testUnsupportedTypesOrdinalGrouping
+ issue: https://github.com/elastic/elasticsearch/issues/122342
# Examples:
#
From 49eccbe52da2ce88481368e9be0eac52dadc070c Mon Sep 17 00:00:00 2001
From: elasticsearchmachine
<58790826+elasticsearchmachine@users.noreply.github.com>
Date: Wed, 12 Feb 2025 20:07:05 +1100
Subject: [PATCH 09/93] Mute
org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT test
{yaml=reference/alias/line_260} #122343
---
muted-tests.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/muted-tests.yml b/muted-tests.yml
index 6b2546cebc88..7a87efd0b158 100644
--- a/muted-tests.yml
+++ b/muted-tests.yml
@@ -423,6 +423,9 @@ tests:
- class: org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT
method: testUnsupportedTypesOrdinalGrouping
issue: https://github.com/elastic/elasticsearch/issues/122342
+- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
+ method: test {yaml=reference/alias/line_260}
+ issue: https://github.com/elastic/elasticsearch/issues/122343
# Examples:
#
From f3b3297f9eecac5cbbd036cfbbbbab647cd1be40 Mon Sep 17 00:00:00 2001
From: Tanguy Leroux
Date: Wed, 12 Feb 2025 11:09:53 +0100
Subject: [PATCH 10/93] Sets the new engine before closing the previous one in
IndexShard.resetEngine (#122255)
Current code closes the previous engine instance, creates the new engine and then updates the currentEngineReference:
IOUtils.close(currentEngine);
var newEngine = createEngine(engineConfig);
currentEngineReference.set(newEngine);
This leaves more room for callers of getEngineOrNull() to pick a closed instance. Instead we can create the new engine first and atomically update the reference to the new instance.
---
.../java/org/elasticsearch/index/shard/IndexShard.java | 10 ++++------
.../org/elasticsearch/index/shard/IndexShardTests.java | 6 ++----
2 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java b/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java
index e5085ce9944b..d56d7471d498 100644
--- a/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java
+++ b/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java
@@ -4313,17 +4313,15 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
assert waitForEngineOrClosedShardListeners.isDone();
try {
synchronized (engineMutex) {
- final var currentEngine = getEngine();
- currentEngine.prepareForEngineReset();
- var engineConfig = newEngineConfig(replicationTracker);
verifyNotClosed();
- IOUtils.close(currentEngine);
- var newEngine = createEngine(engineConfig);
- currentEngineReference.set(newEngine);
+ getEngine().prepareForEngineReset();
+ var newEngine = createEngine(newEngineConfig(replicationTracker));
+ IOUtils.close(currentEngineReference.getAndSet(newEngine));
onNewEngine(newEngine);
}
onSettingsChanged();
} catch (Exception e) {
+ // we want to fail the shard in the case prepareForEngineReset throws
failShard("unable to reset engine", e);
}
}
diff --git a/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java b/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java
index 4549a329d499..c07b396626c4 100644
--- a/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java
+++ b/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java
@@ -4563,11 +4563,9 @@ public class IndexShardTests extends IndexShardTestCase {
var newEngineCreated = new CountDownLatch(2);
var indexShard = newStartedShard(true, Settings.EMPTY, config -> {
try {
- return new ReadOnlyEngine(config, null, null, true, Function.identity(), true, true) {
+ return new ReadOnlyEngine(config, null, new TranslogStats(), false, Function.identity(), true, true) {
@Override
- public void prepareForEngineReset() throws IOException {
- ;
- }
+ public void prepareForEngineReset() throws IOException {}
};
} finally {
newEngineCreated.countDown();
From 656b54bc74ee46994e14150459aed7ac50876f30 Mon Sep 17 00:00:00 2001
From: Jan Kuipers <148754765+jan-elastic@users.noreply.github.com>
Date: Wed, 12 Feb 2025 11:25:03 +0100
Subject: [PATCH 11/93] Unmute changepoint tests (#122351)
---
muted-tests.yml | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/muted-tests.yml b/muted-tests.yml
index 7a87efd0b158..240efdcf8d0a 100644
--- a/muted-tests.yml
+++ b/muted-tests.yml
@@ -381,15 +381,6 @@ tests:
- class: org.elasticsearch.search.SearchCancellationIT
method: testCancelFailedSearchWhenPartialResultDisallowed
issue: https://github.com/elastic/elasticsearch/issues/121719
-- class: org.elasticsearch.xpack.esql.analysis.VerifierTests
- method: testChangePoint
- issue: https://github.com/elastic/elasticsearch/issues/122179
-- class: org.elasticsearch.xpack.esql.analysis.VerifierTests
- method: testChangePoint_keySortable
- issue: https://github.com/elastic/elasticsearch/issues/122180
-- class: org.elasticsearch.xpack.esql.analysis.VerifierTests
- method: testChangePoint_valueNumeric
- issue: https://github.com/elastic/elasticsearch/issues/122181
- class: org.elasticsearch.datastreams.TSDBPassthroughIndexingIT
issue: https://github.com/elastic/elasticsearch/issues/121716
- class: org.elasticsearch.smoketest.SmokeTestMonitoringWithSecurityIT
From 858769ddb65d0f22c3bc602f1b3196313963677a Mon Sep 17 00:00:00 2001
From: Armin Braun
Date: Wed, 12 Feb 2025 11:40:48 +0100
Subject: [PATCH 12/93] Simplify comparators in InternalOrder (#122330)
We can build slightly more compact (and likely also faster) iterators
while using less code for these. Also, no need to create method
references as a way of casting.
---
.../search/aggregations/InternalOrder.java | 55 +++++++------------
1 file changed, 20 insertions(+), 35 deletions(-)
diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/InternalOrder.java b/server/src/main/java/org/elasticsearch/search/aggregations/InternalOrder.java
index afeeaa9bd675..ead1374fb9b4 100644
--- a/server/src/main/java/org/elasticsearch/search/aggregations/InternalOrder.java
+++ b/server/src/main/java/org/elasticsearch/search/aggregations/InternalOrder.java
@@ -26,6 +26,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
@@ -188,33 +189,22 @@ public abstract class InternalOrder extends BucketOrder {
@Override
public Comparator> partiallyBuiltBucketComparator(Aggregator aggregator) {
- List>> comparators = new ArrayList<>(orderElements.size());
- for (BucketOrder order : orderElements) {
- comparators.add(order.partiallyBuiltBucketComparator(aggregator));
+ Iterator iterator = orderElements.iterator();
+ Comparator> comparator = iterator.next().partiallyBuiltBucketComparator(aggregator);
+ while (iterator.hasNext()) {
+ comparator = comparator.thenComparing(iterator.next().partiallyBuiltBucketComparator(aggregator));
}
- return (lhs, rhs) -> {
- for (Comparator> c : comparators) {
- int result = c.compare(lhs, rhs);
- if (result != 0) {
- return result;
- }
- }
- return 0;
- };
+ return comparator;
}
@Override
public Comparator comparator() {
- List> comparators = orderElements.stream().map(BucketOrder::comparator).toList();
- return (lhs, rhs) -> {
- for (Comparator c : comparators) {
- int result = c.compare(lhs, rhs);
- if (result != 0) {
- return result;
- }
- }
- return 0;
- };
+ Iterator iterator = orderElements.iterator();
+ Comparator comparator = iterator.next().comparator();
+ while (iterator.hasNext()) {
+ comparator = comparator.thenComparing(iterator.next().comparator());
+ }
+ return comparator;
}
@Override
@@ -222,18 +212,12 @@ public abstract class InternalOrder extends BucketOrder {
BiFunction, AggregationReduceContext, B> reduce,
AggregationReduceContext reduceContext
) {
- List>> comparators = orderElements.stream()
- .map(b -> b.delayedBucketComparator(reduce, reduceContext))
- .toList();
- return (lhs, rhs) -> {
- for (Comparator> c : comparators) {
- int result = c.compare(lhs, rhs);
- if (result != 0) {
- return result;
- }
- }
- return 0;
- };
+ Iterator iterator = orderElements.iterator();
+ Comparator> comparator = iterator.next().delayedBucketComparator(reduce, reduceContext);
+ while (iterator.hasNext()) {
+ comparator = comparator.thenComparing(iterator.next().delayedBucketComparator(reduce, reduceContext));
+ }
+ return comparator;
}
@Override
@@ -285,12 +269,13 @@ public abstract class InternalOrder extends BucketOrder {
return comparator;
}
+ @SuppressWarnings({ "rawtypes", "unchecked" })
@Override
Comparator> delayedBucketComparator(
BiFunction, AggregationReduceContext, B> reduce,
AggregationReduceContext reduceContext
) {
- return delayedBucketCompator::compare;
+ return (Comparator) delayedBucketCompator;
}
@Override
From e8bbf27146aa978cd5edce42729f277b9f4c7999 Mon Sep 17 00:00:00 2001
From: Valeriy Khakhutskyy <1292899+valeriy42@users.noreply.github.com>
Date: Wed, 12 Feb 2025 12:09:08 +0100
Subject: [PATCH 13/93] [ML] Unmute fixed Classification IT tests #122352
Unmute tests following #122268
Closes #120071
Closes #121680
Closes #121492
Closes #121415
Closes #121236
---
muted-tests.yml | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/muted-tests.yml b/muted-tests.yml
index 240efdcf8d0a..9fc54786d579 100644
--- a/muted-tests.yml
+++ b/muted-tests.yml
@@ -254,9 +254,6 @@ tests:
- class: org.elasticsearch.xpack.security.FileSettingsRoleMappingsRestartIT
method: testFileSettingsReprocessedOnRestartWithoutVersionChange
issue: https://github.com/elastic/elasticsearch/issues/120964
-- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
- method: testWithOnlyTrainingRowsAndTrainingPercentIsFifty_DependentVariableIsKeyword
- issue: https://github.com/elastic/elasticsearch/issues/120071
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
method: testGetUsersWithProfileUidWhenProfileIndexDoesNotExists
issue: https://github.com/elastic/elasticsearch/issues/121179
@@ -265,9 +262,6 @@ tests:
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
method: testSetEnabled
issue: https://github.com/elastic/elasticsearch/issues/121183
-- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
- method: testWithDatastreams
- issue: https://github.com/elastic/elasticsearch/issues/121236
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
method: test {p0=transform/*}
issue: https://github.com/elastic/elasticsearch/issues/120816
@@ -317,9 +311,6 @@ tests:
issue: https://github.com/elastic/elasticsearch/issues/121151
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
issue: https://github.com/elastic/elasticsearch/issues/121407
-- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
- method: testDependentVariableIsAliasToNested
- issue: https://github.com/elastic/elasticsearch/issues/121415
- class: org.elasticsearch.xpack.security.authc.jwt.JwtRealmSingleNodeTests
method: testClientSecretRotation
issue: https://github.com/elastic/elasticsearch/issues/120985
@@ -347,9 +338,6 @@ tests:
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
method: test {p0=search.vectors/42_knn_search_int4_flat/Vector similarity with filter only}
issue: https://github.com/elastic/elasticsearch/issues/121412
-- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
- method: testDependentVariableIsAliasToKeyword
- issue: https://github.com/elastic/elasticsearch/issues/121492
- class: org.elasticsearch.search.CrossClusterSearchUnavailableClusterIT
method: testSearchSkipUnavailable
issue: https://github.com/elastic/elasticsearch/issues/121497
@@ -372,9 +360,6 @@ tests:
- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
method: test {yaml=snapshot.delete/10_basic/Delete a snapshot asynchronously}
issue: https://github.com/elastic/elasticsearch/issues/122102
-- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
- method: testWithOnlyTrainingRowsAndTrainingPercentIsFifty_DependentVariableIsBoolean
- issue: https://github.com/elastic/elasticsearch/issues/121680
- class: org.elasticsearch.xpack.downsample.DownsampleActionSingleNodeTests
method: testDuplicateDownsampleRequest
issue: https://github.com/elastic/elasticsearch/issues/122158
From ec7f4ccb04fe033a1e12795b84767a44fc7a1512 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lorenzo=20Dematt=C3=A9?=
Date: Wed, 12 Feb 2025 14:04:18 +0100
Subject: [PATCH 14/93] [Entitlements] Add FileStore instrumentation + tests
(#122348)
---
.../bridge/EntitlementChecker.java | 20 +++++
.../entitlement/qa/test/FileCheckActions.java | 10 +--
.../entitlement/qa/test/FileStoreActions.java | 71 ++++++++++++++++
.../qa/test/RestEntitlementsCheckAction.java | 3 +-
.../EntitlementInitialization.java | 84 +++++++++++++++----
.../api/ElasticsearchEntitlementChecker.java | 46 ++++++++++
.../runtime/policy/PolicyManager.java | 9 ++
.../ReadStoreAttributesEntitlement.java | 15 ++++
8 files changed, 236 insertions(+), 22 deletions(-)
create mode 100644 libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/FileStoreActions.java
create mode 100644 libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/entitlements/ReadStoreAttributesEntitlement.java
diff --git a/libs/entitlement/bridge/src/main/java/org/elasticsearch/entitlement/bridge/EntitlementChecker.java b/libs/entitlement/bridge/src/main/java/org/elasticsearch/entitlement/bridge/EntitlementChecker.java
index 28306cc0e660..6e6e5f306c80 100644
--- a/libs/entitlement/bridge/src/main/java/org/elasticsearch/entitlement/bridge/EntitlementChecker.java
+++ b/libs/entitlement/bridge/src/main/java/org/elasticsearch/entitlement/bridge/EntitlementChecker.java
@@ -50,6 +50,7 @@ import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.nio.channels.spi.SelectorProvider;
import java.nio.charset.Charset;
+import java.nio.file.FileStore;
import java.nio.file.LinkOption;
import java.nio.file.OpenOption;
import java.nio.file.Path;
@@ -523,4 +524,23 @@ public interface EntitlementChecker {
// file system providers
void checkNewInputStream(Class> callerClass, FileSystemProvider that, Path path, OpenOption... options);
+
+ // file store
+ void checkGetFileStoreAttributeView(Class> callerClass, FileStore that, Class> type);
+
+ void checkGetAttribute(Class> callerClass, FileStore that, String attribute);
+
+ void checkGetBlockSize(Class> callerClass, FileStore that);
+
+ void checkGetTotalSpace(Class> callerClass, FileStore that);
+
+ void checkGetUnallocatedSpace(Class> callerClass, FileStore that);
+
+ void checkGetUsableSpace(Class> callerClass, FileStore that);
+
+ void checkIsReadOnly(Class> callerClass, FileStore that);
+
+ void checkName(Class> callerClass, FileStore that);
+
+ void checkType(Class> callerClass, FileStore that);
}
diff --git a/libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/FileCheckActions.java b/libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/FileCheckActions.java
index c62f6c003fe7..4a15d63f99ec 100644
--- a/libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/FileCheckActions.java
+++ b/libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/FileCheckActions.java
@@ -27,21 +27,21 @@ import static org.elasticsearch.entitlement.qa.test.EntitlementTest.ExpectedAcce
@SuppressForbidden(reason = "Explicitly checking APIs that are forbidden")
class FileCheckActions {
- private static Path testRootDir = Paths.get(System.getProperty("es.entitlements.testdir"));
+ static Path testRootDir = Paths.get(System.getProperty("es.entitlements.testdir"));
- private static Path readDir() {
+ static Path readDir() {
return testRootDir.resolve("read_dir");
}
- private static Path readWriteDir() {
+ static Path readWriteDir() {
return testRootDir.resolve("read_write_dir");
}
- private static Path readFile() {
+ static Path readFile() {
return testRootDir.resolve("read_file");
}
- private static Path readWriteFile() {
+ static Path readWriteFile() {
return testRootDir.resolve("read_write_file");
}
diff --git a/libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/FileStoreActions.java b/libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/FileStoreActions.java
new file mode 100644
index 000000000000..0c8026ea9fee
--- /dev/null
+++ b/libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/FileStoreActions.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the "Elastic License
+ * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
+ * Public License v 1"; you may not use this file except in compliance with, at
+ * your election, the "Elastic License 2.0", the "GNU Affero General Public
+ * License v3.0 only", or the "Server Side Public License, v 1".
+ */
+
+package org.elasticsearch.entitlement.qa.test;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.attribute.FileStoreAttributeView;
+
+import static org.elasticsearch.entitlement.qa.test.EntitlementTest.ExpectedAccess.ALWAYS_DENIED;
+import static org.elasticsearch.entitlement.qa.test.EntitlementTest.ExpectedAccess.SERVER_ONLY;
+
+class FileStoreActions {
+
+ @EntitlementTest(expectedAccess = ALWAYS_DENIED)
+ static void checkGetFileStoreAttributeView() throws IOException {
+ Files.getFileStore(FileCheckActions.readWriteFile()).getFileStoreAttributeView(FileStoreAttributeView.class);
+ }
+
+ @EntitlementTest(expectedAccess = SERVER_ONLY)
+ static void checkGetAttribute() throws IOException {
+ try {
+ Files.getFileStore(FileCheckActions.readFile()).getAttribute("zfs:compression");
+ } catch (UnsupportedOperationException e) {
+ // It's OK if the attribute view is not available or it does not support reading the attribute
+ }
+ }
+
+ @EntitlementTest(expectedAccess = SERVER_ONLY)
+ static void checkGetBlockSize() throws IOException {
+ Files.getFileStore(FileCheckActions.readWriteFile()).getBlockSize();
+ }
+
+ @EntitlementTest(expectedAccess = SERVER_ONLY)
+ static void checkGetTotalSpace() throws IOException {
+ Files.getFileStore(FileCheckActions.readWriteFile()).getTotalSpace();
+ }
+
+ @EntitlementTest(expectedAccess = SERVER_ONLY)
+ static void checkGetUnallocatedSpace() throws IOException {
+ Files.getFileStore(FileCheckActions.readWriteFile()).getUnallocatedSpace();
+ }
+
+ @EntitlementTest(expectedAccess = SERVER_ONLY)
+ static void checkGetUsableSpace() throws IOException {
+ Files.getFileStore(FileCheckActions.readFile()).getUsableSpace();
+ }
+
+ @EntitlementTest(expectedAccess = SERVER_ONLY)
+ static void checkIsReadOnly() throws IOException {
+ Files.getFileStore(FileCheckActions.readFile()).isReadOnly();
+ }
+
+ @EntitlementTest(expectedAccess = SERVER_ONLY)
+ static void checkName() throws IOException {
+ Files.getFileStore(FileCheckActions.readFile()).name();
+ }
+
+ @EntitlementTest(expectedAccess = SERVER_ONLY)
+ static void checkType() throws IOException {
+ Files.getFileStore(FileCheckActions.readFile()).type();
+ }
+
+ private FileStoreActions() {}
+}
diff --git a/libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/RestEntitlementsCheckAction.java b/libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/RestEntitlementsCheckAction.java
index dbc9a7692b70..315ff9d2b526 100644
--- a/libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/RestEntitlementsCheckAction.java
+++ b/libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/RestEntitlementsCheckAction.java
@@ -185,7 +185,8 @@ public class RestEntitlementsCheckAction extends BaseRestHandler {
getTestEntries(FileCheckActions.class),
getTestEntries(SpiActions.class),
getTestEntries(SystemActions.class),
- getTestEntries(NativeActions.class)
+ getTestEntries(NativeActions.class),
+ getTestEntries(FileStoreActions.class)
)
.flatMap(Function.identity())
.filter(entry -> entry.getValue().fromJavaVersion() == null || Runtime.version().feature() >= entry.getValue().fromJavaVersion())
diff --git a/libs/entitlement/src/main/java/org/elasticsearch/entitlement/initialization/EntitlementInitialization.java b/libs/entitlement/src/main/java/org/elasticsearch/entitlement/initialization/EntitlementInitialization.java
index 8935d718b830..0b0caa0745fc 100644
--- a/libs/entitlement/src/main/java/org/elasticsearch/entitlement/initialization/EntitlementInitialization.java
+++ b/libs/entitlement/src/main/java/org/elasticsearch/entitlement/initialization/EntitlementInitialization.java
@@ -27,11 +27,13 @@ import org.elasticsearch.entitlement.runtime.policy.entitlements.ExitVMEntitleme
import org.elasticsearch.entitlement.runtime.policy.entitlements.InboundNetworkEntitlement;
import org.elasticsearch.entitlement.runtime.policy.entitlements.LoadNativeLibrariesEntitlement;
import org.elasticsearch.entitlement.runtime.policy.entitlements.OutboundNetworkEntitlement;
+import org.elasticsearch.entitlement.runtime.policy.entitlements.ReadStoreAttributesEntitlement;
import java.lang.instrument.Instrumentation;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.nio.channels.spi.SelectorProvider;
+import java.nio.file.FileStore;
import java.nio.file.FileSystems;
import java.nio.file.OpenOption;
import java.nio.file.Path;
@@ -43,6 +45,7 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
/**
* Called by the agent during {@code agentmain} to configure the entitlement system,
@@ -58,6 +61,11 @@ public class EntitlementInitialization {
private static ElasticsearchEntitlementChecker manager;
+ interface InstrumentationInfoFunction {
+ InstrumentationService.InstrumentationInfo of(String methodName, Class>... parameterTypes) throws ClassNotFoundException,
+ NoSuchMethodException;
+ }
+
// Note: referenced by bridge reflectively
public static EntitlementChecker checker() {
return manager;
@@ -71,22 +79,26 @@ public class EntitlementInitialization {
Map checkMethods = new HashMap<>(INSTRUMENTATION_SERVICE.lookupMethods(latestCheckerInterface));
var fileSystemProviderClass = FileSystems.getDefault().provider().getClass();
- Stream.of(
- INSTRUMENTATION_SERVICE.lookupImplementationMethod(
- FileSystemProvider.class,
- "newInputStream",
- fileSystemProviderClass,
- EntitlementChecker.class,
- "checkNewInputStream",
- Path.class,
- OpenOption[].class
- ),
- INSTRUMENTATION_SERVICE.lookupImplementationMethod(
- SelectorProvider.class,
- "inheritedChannel",
- SelectorProvider.provider().getClass(),
- EntitlementChecker.class,
- "checkSelectorProviderInheritedChannel"
+
+ Stream.concat(
+ fileStoreChecks(),
+ Stream.of(
+ INSTRUMENTATION_SERVICE.lookupImplementationMethod(
+ FileSystemProvider.class,
+ "newInputStream",
+ fileSystemProviderClass,
+ EntitlementChecker.class,
+ "checkNewInputStream",
+ Path.class,
+ OpenOption[].class
+ ),
+ INSTRUMENTATION_SERVICE.lookupImplementationMethod(
+ SelectorProvider.class,
+ "inheritedChannel",
+ SelectorProvider.provider().getClass(),
+ EntitlementChecker.class,
+ "checkSelectorProviderInheritedChannel"
+ )
)
).forEach(instrumentation -> checkMethods.put(instrumentation.targetMethod(), instrumentation.checkMethod()));
@@ -120,6 +132,7 @@ public class EntitlementInitialization {
"org.elasticsearch.server",
List.of(
new ExitVMEntitlement(),
+ new ReadStoreAttributesEntitlement(),
new CreateClassLoaderEntitlement(),
new InboundNetworkEntitlement(),
new OutboundNetworkEntitlement(),
@@ -139,6 +152,45 @@ public class EntitlementInitialization {
return new PolicyManager(serverPolicy, agentEntitlements, pluginPolicies, resolver, AGENTS_PACKAGE_NAME, ENTITLEMENTS_MODULE);
}
+ private static Stream fileStoreChecks() {
+ var fileStoreClasses = StreamSupport.stream(FileSystems.getDefault().getFileStores().spliterator(), false)
+ .map(FileStore::getClass)
+ .distinct();
+ return fileStoreClasses.flatMap(fileStoreClass -> {
+ var instrumentation = new InstrumentationInfoFunction() {
+ @Override
+ public InstrumentationService.InstrumentationInfo of(String methodName, Class>... parameterTypes)
+ throws ClassNotFoundException, NoSuchMethodException {
+ return INSTRUMENTATION_SERVICE.lookupImplementationMethod(
+ FileStore.class,
+ methodName,
+ fileStoreClass,
+ EntitlementChecker.class,
+ "check" + Character.toUpperCase(methodName.charAt(0)) + methodName.substring(1),
+ parameterTypes
+ );
+ }
+ };
+
+ try {
+ return Stream.of(
+ instrumentation.of("getFileStoreAttributeView", Class.class),
+ instrumentation.of("getAttribute", String.class),
+ instrumentation.of("getBlockSize"),
+ instrumentation.of("getTotalSpace"),
+ instrumentation.of("getUnallocatedSpace"),
+ instrumentation.of("getUsableSpace"),
+ instrumentation.of("isReadOnly"),
+ instrumentation.of("name"),
+ instrumentation.of("type")
+
+ );
+ } catch (NoSuchMethodException | ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ });
+ }
+
/**
* Returns the "most recent" checker class compatible with the current runtime Java version.
* For checkers, we have (optionally) version specific classes, each with a prefix (e.g. Java23).
diff --git a/libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/api/ElasticsearchEntitlementChecker.java b/libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/api/ElasticsearchEntitlementChecker.java
index 50e3e6d9c55e..156ae9cc4a35 100644
--- a/libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/api/ElasticsearchEntitlementChecker.java
+++ b/libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/api/ElasticsearchEntitlementChecker.java
@@ -55,6 +55,7 @@ import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.nio.channels.spi.SelectorProvider;
import java.nio.charset.Charset;
+import java.nio.file.FileStore;
import java.nio.file.LinkOption;
import java.nio.file.OpenOption;
import java.nio.file.Path;
@@ -998,4 +999,49 @@ public class ElasticsearchEntitlementChecker implements EntitlementChecker {
public void checkNewInputStream(Class> callerClass, FileSystemProvider that, Path path, OpenOption... options) {
// TODO: policyManger.checkFileSystemRead(path);
}
+
+ @Override
+ public void checkGetFileStoreAttributeView(Class> callerClass, FileStore that, Class> type) {
+ policyManager.checkWriteStoreAttributes(callerClass);
+ }
+
+ @Override
+ public void checkGetAttribute(Class> callerClass, FileStore that, String attribute) {
+ policyManager.checkReadStoreAttributes(callerClass);
+ }
+
+ @Override
+ public void checkGetBlockSize(Class> callerClass, FileStore that) {
+ policyManager.checkReadStoreAttributes(callerClass);
+ }
+
+ @Override
+ public void checkGetTotalSpace(Class> callerClass, FileStore that) {
+ policyManager.checkReadStoreAttributes(callerClass);
+ }
+
+ @Override
+ public void checkGetUnallocatedSpace(Class> callerClass, FileStore that) {
+ policyManager.checkReadStoreAttributes(callerClass);
+ }
+
+ @Override
+ public void checkGetUsableSpace(Class> callerClass, FileStore that) {
+ policyManager.checkReadStoreAttributes(callerClass);
+ }
+
+ @Override
+ public void checkIsReadOnly(Class> callerClass, FileStore that) {
+ policyManager.checkReadStoreAttributes(callerClass);
+ }
+
+ @Override
+ public void checkName(Class> callerClass, FileStore that) {
+ policyManager.checkReadStoreAttributes(callerClass);
+ }
+
+ @Override
+ public void checkType(Class> callerClass, FileStore that) {
+ policyManager.checkReadStoreAttributes(callerClass);
+ }
}
diff --git a/libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java b/libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java
index 393eb93478e6..b4d099007866 100644
--- a/libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java
+++ b/libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java
@@ -20,6 +20,7 @@ import org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlemen
import org.elasticsearch.entitlement.runtime.policy.entitlements.InboundNetworkEntitlement;
import org.elasticsearch.entitlement.runtime.policy.entitlements.LoadNativeLibrariesEntitlement;
import org.elasticsearch.entitlement.runtime.policy.entitlements.OutboundNetworkEntitlement;
+import org.elasticsearch.entitlement.runtime.policy.entitlements.ReadStoreAttributesEntitlement;
import org.elasticsearch.entitlement.runtime.policy.entitlements.SetHttpsConnectionPropertiesEntitlement;
import org.elasticsearch.entitlement.runtime.policy.entitlements.WriteSystemPropertiesEntitlement;
import org.elasticsearch.logging.LogManager;
@@ -181,6 +182,14 @@ public class PolicyManager {
neverEntitled(callerClass, () -> "start process");
}
+ public void checkWriteStoreAttributes(Class> callerClass) {
+ neverEntitled(callerClass, () -> "change file store attributes");
+ }
+
+ public void checkReadStoreAttributes(Class> callerClass) {
+ checkEntitlementPresent(callerClass, ReadStoreAttributesEntitlement.class);
+ }
+
/**
* @param operationDescription is only called when the operation is not trivially allowed, meaning the check is about to fail;
* therefore, its performance is not a major concern.
diff --git a/libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/entitlements/ReadStoreAttributesEntitlement.java b/libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/entitlements/ReadStoreAttributesEntitlement.java
new file mode 100644
index 000000000000..ccb84c4a68c9
--- /dev/null
+++ b/libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/entitlements/ReadStoreAttributesEntitlement.java
@@ -0,0 +1,15 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the "Elastic License
+ * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
+ * Public License v 1"; you may not use this file except in compliance with, at
+ * your election, the "Elastic License 2.0", the "GNU Affero General Public
+ * License v3.0 only", or the "Server Side Public License, v 1".
+ */
+
+package org.elasticsearch.entitlement.runtime.policy.entitlements;
+
+/**
+ * Describes an entitlement for reading file store attributes (e.g. disk space)
+ */
+public record ReadStoreAttributesEntitlement() implements Entitlement {}
From 65f6b44b2a0759fa6c950e8646d2e8aed0937aab Mon Sep 17 00:00:00 2001
From: Kostas Krikellas <131142368+kkrik-es@users.noreply.github.com>
Date: Wed, 12 Feb 2025 15:07:38 +0200
Subject: [PATCH 15/93] Handle error in concurrent downsample actions (#122251)
---
muted-tests.yml | 3 ---
.../xpack/downsample/DownsampleActionSingleNodeTests.java | 4 ++--
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/muted-tests.yml b/muted-tests.yml
index 9fc54786d579..1f42941579cf 100644
--- a/muted-tests.yml
+++ b/muted-tests.yml
@@ -360,9 +360,6 @@ tests:
- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
method: test {yaml=snapshot.delete/10_basic/Delete a snapshot asynchronously}
issue: https://github.com/elastic/elasticsearch/issues/122102
-- class: org.elasticsearch.xpack.downsample.DownsampleActionSingleNodeTests
- method: testDuplicateDownsampleRequest
- issue: https://github.com/elastic/elasticsearch/issues/122158
- class: org.elasticsearch.search.SearchCancellationIT
method: testCancelFailedSearchWhenPartialResultDisallowed
issue: https://github.com/elastic/elasticsearch/issues/121719
diff --git a/x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/DownsampleActionSingleNodeTests.java b/x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/DownsampleActionSingleNodeTests.java
index ce9b60938526..2c759f150e57 100644
--- a/x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/DownsampleActionSingleNodeTests.java
+++ b/x-pack/plugin/downsample/src/test/java/org/elasticsearch/xpack/downsample/DownsampleActionSingleNodeTests.java
@@ -1760,7 +1760,7 @@ public class DownsampleActionSingleNodeTests extends ESSingleNodeTestCase {
new Thread(() -> {
try {
downsample(sourceIndex, targetIndex, config);
- } catch (ResourceAlreadyExistsException e) {
+ } catch (ElasticsearchException e) {
firstFailed.set(true);
} finally {
downsampleComplete.countDown();
@@ -1770,7 +1770,7 @@ public class DownsampleActionSingleNodeTests extends ESSingleNodeTestCase {
new Thread(() -> {
try {
downsample(sourceIndex, targetIndex, config);
- } catch (ResourceAlreadyExistsException e) {
+ } catch (ElasticsearchException e) {
secondFailed.set(true);
} finally {
downsampleComplete.countDown();
From 4b3acd4f5755bb98c5d020af459a198d891d6b3f Mon Sep 17 00:00:00 2001
From: Andrei Stefan
Date: Wed, 12 Feb 2025 15:12:20 +0200
Subject: [PATCH 16/93] ESQL: revive inlinestats (#122257)
---
docs/changelog/122257.yaml | 5 +++
.../xpack/esql/ccq/MultiClusterSpecIT.java | 2 +
....csv-spec-ignored => inlinestats.csv-spec} | 44 +++++++++----------
.../xpack/esql/action/EsqlCapabilities.java | 8 +++-
.../esql/plan/logical/join/InlineJoin.java | 8 ++--
.../xpack/esql/planner/mapper/Mapper.java | 5 +++
6 files changed, 44 insertions(+), 28 deletions(-)
create mode 100644 docs/changelog/122257.yaml
rename x-pack/plugin/esql/qa/testFixtures/src/main/resources/{inlinestats.csv-spec-ignored => inlinestats.csv-spec} (97%)
diff --git a/docs/changelog/122257.yaml b/docs/changelog/122257.yaml
new file mode 100644
index 000000000000..24078170eb6b
--- /dev/null
+++ b/docs/changelog/122257.yaml
@@ -0,0 +1,5 @@
+pr: 122257
+summary: Revive inlinestats
+area: ES|QL
+type: bug
+issues: []
diff --git a/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterSpecIT.java b/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterSpecIT.java
index 84bf34b70372..723c5e2dfd1a 100644
--- a/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterSpecIT.java
+++ b/x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterSpecIT.java
@@ -48,6 +48,7 @@ import static org.elasticsearch.xpack.esql.CsvTestsDataLoader.ENRICH_SOURCE_INDI
import static org.elasticsearch.xpack.esql.EsqlTestUtils.classpathResources;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.INLINESTATS;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.INLINESTATS_V2;
+import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.INLINESTATS_V3;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.JOIN_LOOKUP_V12;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.JOIN_PLANNING_V1;
import static org.elasticsearch.xpack.esql.action.EsqlCapabilities.Cap.METADATA_FIELDS_REMOTE_TEST;
@@ -124,6 +125,7 @@ public class MultiClusterSpecIT extends EsqlSpecTestCase {
assumeFalse("INLINESTATS not yet supported in CCS", testCase.requiredCapabilities.contains(INLINESTATS.capabilityName()));
assumeFalse("INLINESTATS not yet supported in CCS", testCase.requiredCapabilities.contains(INLINESTATS_V2.capabilityName()));
assumeFalse("INLINESTATS not yet supported in CCS", testCase.requiredCapabilities.contains(JOIN_PLANNING_V1.capabilityName()));
+ assumeFalse("INLINESTATS not yet supported in CCS", testCase.requiredCapabilities.contains(INLINESTATS_V3.capabilityName()));
assumeFalse("LOOKUP JOIN not yet supported in CCS", testCase.requiredCapabilities.contains(JOIN_LOOKUP_V12.capabilityName()));
}
diff --git a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/inlinestats.csv-spec-ignored b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/inlinestats.csv-spec
similarity index 97%
rename from x-pack/plugin/esql/qa/testFixtures/src/main/resources/inlinestats.csv-spec-ignored
rename to x-pack/plugin/esql/qa/testFixtures/src/main/resources/inlinestats.csv-spec
index 91075691a6a1..cf2d44665bd5 100644
--- a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/inlinestats.csv-spec-ignored
+++ b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/inlinestats.csv-spec
@@ -2,8 +2,8 @@
// TODO: re-enable the commented tests once the Join functionality stabilizes
//
-maxOfInt-Ignore
-required_capability: join_planning_v1
+maxOfInt
+required_capability: inlinestats_v3
// tag::max-languages[]
FROM employees
| KEEP emp_no, languages
@@ -25,7 +25,7 @@ emp_no:integer | languages:integer | max_lang:integer
;
maxOfIntByKeyword
-required_capability: join_planning_v1
+required_capability: inlinestats_v3
FROM employees
| KEEP emp_no, languages, gender
@@ -43,7 +43,7 @@ emp_no:integer | languages:integer | gender:keyword | max_lang:integer
;
maxOfLongByKeyword
-required_capability: join_planning_v1
+required_capability: inlinestats_v3
FROM employees
| KEEP emp_no, avg_worked_seconds, gender
@@ -57,8 +57,8 @@ emp_no:integer | avg_worked_seconds:long | gender:keyword | max_avg_worked_secon
10030 | 394597613 | M | 394597613
;
-maxOfLong-Ignore
-required_capability: join_planning_v1
+maxOfLong
+required_capability: inlinestats_v3
FROM employees
| KEEP emp_no, avg_worked_seconds, gender
@@ -71,7 +71,7 @@ emp_no:integer | avg_worked_seconds:long | gender:keyword | max_avg_worked_secon
;
maxOfLongByCalculatedKeyword
-required_capability: join_planning_v1
+required_capability: inlinestats_v3
// tag::longest-tenured-by-first[]
FROM employees
@@ -94,7 +94,7 @@ emp_no:integer | avg_worked_seconds:long | last_name:keyword | SUBSTRING(last_na
;
maxOfLongByCalculatedNamedKeyword
-required_capability: join_planning_v1
+required_capability: inlinestats_v3
FROM employees
| KEEP emp_no, avg_worked_seconds, last_name
@@ -112,7 +112,7 @@ emp_no:integer | avg_worked_seconds:long | last_name:keyword | l:keyword | max_a
10087 | 305782871 | Eugenio | E | 305782871
;
-maxOfLongByCalculatedDroppedKeyword
+maxOfLongByCalculatedDroppedKeyword-Ignore
required_capability: join_planning_v1
FROM employees
@@ -132,7 +132,7 @@ emp_no:integer | avg_worked_seconds:long | last_name:keyword | max_avg_worked_se
;
maxOfLongByEvaledKeyword
-required_capability: join_planning_v1
+required_capability: inlinestats_v3
FROM employees
| EVAL l = SUBSTRING(last_name, 0, 1)
@@ -152,7 +152,7 @@ emp_no:integer | avg_worked_seconds:long | l:keyword | max_avg_worked_seconds:lo
;
maxOfLongByInt
-required_capability: join_planning_v1
+required_capability: inlinestats_v3
FROM employees
| KEEP emp_no, avg_worked_seconds, languages
@@ -170,7 +170,7 @@ emp_no:integer | avg_worked_seconds:long | languages:integer | max_avg_worked_se
;
maxOfLongByIntDouble
-required_capability: join_planning_v1
+required_capability: inlinestats_v3
FROM employees
| KEEP emp_no, avg_worked_seconds, languages, height
@@ -205,7 +205,7 @@ emp_no:integer | languages:integer | avg_worked_seconds:long | gender:keyword |
10007 | 4 | 393084805 | F | 2.863684210555556E8 | 5
;
-byMultivaluedSimple
+byMultivaluedSimple-Ignore
required_capability: join_planning_v1
// tag::mv-group[]
@@ -223,7 +223,7 @@ abbrev:keyword | type:keyword | scalerank:integer | min_scalerank:integer
// end::mv-group-result[]
;
-byMultivaluedMvExpand
+byMultivaluedMvExpand-Ignore
required_capability: join_planning_v1
// tag::mv-expand[]
@@ -243,7 +243,7 @@ abbrev:keyword | type:keyword | scalerank:integer | min_scalerank:integer
// end::mv-expand-result[]
;
-byMvExpand
+byMvExpand-Ignore
required_capability: join_planning_v1
// tag::extreme-airports[]
@@ -307,7 +307,7 @@ count:long | country:keyword | avg:double
17 | United Kingdom | 4.455
;
-afterWhere
+afterWhere-Ignore
required_capability: join_planning_v1
FROM airports
@@ -366,8 +366,8 @@ abbrev:keyword | city:keyword | region:text | "COUNT(*)":long
FUK | Fukuoka | 中央区 | 2
;
-beforeStats-Ignore
-required_capability: join_planning_v1
+beforeStats
+required_capability: inlinestats_v3
FROM airports
| EVAL lat = ST_Y(location)
@@ -379,7 +379,7 @@ northern:long | southern:long
520 | 371
;
-beforeKeepSort
+beforeKeepSort-Ignore
required_capability: join_planning_v1
FROM employees
@@ -394,7 +394,7 @@ emp_no:integer | languages:integer | max_salary:integer
10003 | 4 | 74572
;
-beforeKeepWhere
+beforeKeepWhere-Ignore
required_capability: join_planning_v1
FROM employees
@@ -537,8 +537,8 @@ emp_no:integer | one:integer
10005 | 1
;
-percentile-Ignore
-required_capability: join_planning_v1
+percentile
+required_capability: inlinestats_v3
FROM employees
| KEEP emp_no, salary
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
index 0b9b0995d3ba..59e52a409e66 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
@@ -808,7 +808,13 @@ public class EsqlCapabilities {
* and https://github.com/elastic/elasticsearch/issues/120803
* Support for queries that have multiple SORTs that cannot become TopN
*/
- REMOVE_REDUNDANT_SORT;
+ REMOVE_REDUNDANT_SORT,
+
+ /**
+ * Fixes a series of issues with inlinestats which had an incomplete implementation after lookup and inlinestats
+ * were refactored.
+ */
+ INLINESTATS_V3;
private final boolean enabled;
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/logical/join/InlineJoin.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/logical/join/InlineJoin.java
index 87c9db1db480..e3daa4fcbfb9 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/logical/join/InlineJoin.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/logical/join/InlineJoin.java
@@ -16,10 +16,9 @@ import org.elasticsearch.xpack.esql.core.expression.Attribute;
import org.elasticsearch.xpack.esql.core.expression.Literal;
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
import org.elasticsearch.xpack.esql.core.tree.Source;
-import org.elasticsearch.xpack.esql.core.util.CollectionUtils;
import org.elasticsearch.xpack.esql.io.stream.PlanStreamInput;
+import org.elasticsearch.xpack.esql.plan.logical.Eval;
import org.elasticsearch.xpack.esql.plan.logical.LogicalPlan;
-import org.elasticsearch.xpack.esql.plan.logical.Project;
import org.elasticsearch.xpack.esql.plan.logical.UnaryPlan;
import org.elasticsearch.xpack.esql.plan.logical.local.LocalRelation;
@@ -71,10 +70,9 @@ public class InlineJoin extends Join {
List aliases = new ArrayList<>(schema.size());
for (int i = 0; i < schema.size(); i++) {
Attribute attr = schema.get(i);
- aliases.add(new Alias(attr.source(), attr.name(), Literal.of(attr, BlockUtils.toJavaObject(blocks[i], 0))));
+ aliases.add(new Alias(attr.source(), attr.name(), Literal.of(attr, BlockUtils.toJavaObject(blocks[i], 0)), attr.id()));
}
- LogicalPlan left = target.left();
- return new Project(target.source(), left, CollectionUtils.combine(left.output(), aliases));
+ return new Eval(target.source(), target.left(), aliases);
} else {
return target.replaceRight(data);
}
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/mapper/Mapper.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/mapper/Mapper.java
index 8ea19f545e67..b4560b2e3355 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/mapper/Mapper.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/mapper/Mapper.java
@@ -22,6 +22,7 @@ import org.elasticsearch.xpack.esql.plan.logical.LogicalPlan;
import org.elasticsearch.xpack.esql.plan.logical.OrderBy;
import org.elasticsearch.xpack.esql.plan.logical.TopN;
import org.elasticsearch.xpack.esql.plan.logical.UnaryPlan;
+import org.elasticsearch.xpack.esql.plan.logical.join.InlineJoin;
import org.elasticsearch.xpack.esql.plan.logical.join.Join;
import org.elasticsearch.xpack.esql.plan.logical.join.JoinConfig;
import org.elasticsearch.xpack.esql.plan.logical.join.JoinTypes;
@@ -178,6 +179,10 @@ public class Mapper {
throw new EsqlIllegalArgumentException("unsupported join type [" + config.type() + "]");
}
+ if (join instanceof InlineJoin) {
+ return new FragmentExec(bp);
+ }
+
PhysicalPlan left = map(bp.left());
// only broadcast joins supported for now - hence push down as a streaming operator
From b9d122205ab2de0128148df824ccb895fc01c3da Mon Sep 17 00:00:00 2001
From: Jonathan Buttner <56361221+jonathan-buttner@users.noreply.github.com>
Date: Wed, 12 Feb 2025 08:16:48 -0500
Subject: [PATCH 17/93] [ML] Adding elser default endpoint for EIS (#122066)
* Adding elser default endpoint
* [CI] Auto commit changes from spotless
* Fixing test and allowing duplicate calls
* [CI] Auto commit changes from spotless
* Update docs/changelog/122066.yaml
---------
Co-authored-by: elasticsearchmachine
---
docs/changelog/122066.yaml | 5 +++
...etModelsWithElasticInferenceServiceIT.java | 13 +++++++-
.../InferenceRevokeDefaultEndpointsIT.java | 14 ++++++--
.../inference/registry/ModelRegistry.java | 15 +++++++--
.../elastic/ElasticInferenceService.java | 33 +++++++++++++++++--
...erviceSparseEmbeddingsServiceSettings.java | 2 +-
.../elastic/ElasticInferenceServiceTests.java | 14 ++++++--
7 files changed, 82 insertions(+), 14 deletions(-)
create mode 100644 docs/changelog/122066.yaml
diff --git a/docs/changelog/122066.yaml b/docs/changelog/122066.yaml
new file mode 100644
index 000000000000..79a9129bd542
--- /dev/null
+++ b/docs/changelog/122066.yaml
@@ -0,0 +1,5 @@
+pr: 122066
+summary: Adding elser default endpoint for EIS
+area: Machine Learning
+type: enhancement
+issues: []
diff --git a/x-pack/plugin/inference/qa/inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/inference/InferenceGetModelsWithElasticInferenceServiceIT.java b/x-pack/plugin/inference/qa/inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/inference/InferenceGetModelsWithElasticInferenceServiceIT.java
index 3a2a003636b1..42289c50864e 100644
--- a/x-pack/plugin/inference/qa/inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/inference/InferenceGetModelsWithElasticInferenceServiceIT.java
+++ b/x-pack/plugin/inference/qa/inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/inference/InferenceGetModelsWithElasticInferenceServiceIT.java
@@ -12,10 +12,13 @@ package org.elasticsearch.xpack.inference;
import org.elasticsearch.inference.TaskType;
import java.io.IOException;
+import java.util.List;
+import java.util.Map;
import static org.elasticsearch.xpack.inference.InferenceBaseRestTest.getAllModels;
import static org.elasticsearch.xpack.inference.InferenceBaseRestTest.getModels;
import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.is;
public class InferenceGetModelsWithElasticInferenceServiceIT extends BaseMockEISAuthServerTest {
@@ -23,12 +26,20 @@ public class InferenceGetModelsWithElasticInferenceServiceIT extends BaseMockEIS
var allModels = getAllModels();
var chatCompletionModels = getModels("_all", TaskType.CHAT_COMPLETION);
- assertThat(allModels, hasSize(4));
+ assertThat(allModels, hasSize(5));
assertThat(chatCompletionModels, hasSize(1));
for (var model : chatCompletionModels) {
assertEquals("chat_completion", model.get("task_type"));
}
+ assertInferenceIdTaskType(allModels, ".rainbow-sprinkles-elastic", TaskType.CHAT_COMPLETION);
+ assertInferenceIdTaskType(allModels, ".elser-v2-elastic", TaskType.SPARSE_EMBEDDING);
+ }
+
+ private static void assertInferenceIdTaskType(List