Skip to content

Commit 263c178

Browse files
authored
Cleanup index resolution (#137867)
1 parent 507d1a6 commit 263c178

File tree

5 files changed

+7
-28
lines changed

5 files changed

+7
-28
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlExecutionInfo.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,6 @@ public IncludeExecutionMetadata includeExecutionMetadata() {
185185
return includeExecutionMetadata;
186186
}
187187

188-
public Predicate<String> skipOnFailurePredicate() {
189-
return skipOnFailurePredicate;
190-
}
191-
192188
/**
193189
* Call when ES|QL "planning" phase is complete and query execution (in ComputeService) is about to start.
194190
* Note this is currently only built for a single phase planning/execution model. When INLINE STATS

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/enrich/EnrichPolicyResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ public void messageReceived(LookupRequest request, TransportChannel channel, Tas
447447
}
448448
try (ThreadContext.StoredContext ignored = threadContext.stashWithOrigin(ClientHelper.ENRICH_ORIGIN)) {
449449
String indexName = EnrichPolicy.getBaseName(policyName);
450-
indexResolver.resolveAsMergedMapping(
450+
indexResolver.resolveIndices(
451451
indexName,
452452
IndexResolver.ALL_FIELDS,
453453
null,

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/EsqlSession.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ private void preAnalyzeLookupIndex(
602602
ThreadPool.Names.SEARCH_COORDINATION,
603603
ThreadPool.Names.SYSTEM_READ
604604
);
605-
indexResolver.resolveAsMergedMapping(
605+
indexResolver.resolveIndices(
606606
EsqlCCSUtils.createQualifiedLookupIndexExpressionFromAvailableClusters(executionInfo, localPattern),
607607
result.wildcardJoinIndices().contains(localPattern) ? IndexResolver.ALL_FIELDS : result.fieldNames,
608608
null,
@@ -837,7 +837,7 @@ private void preAnalyzeMainIndices(
837837
// return empty resolution if the expression is pure CCS and resolved no remote clusters (like no-such-cluster*:index)
838838
listener.onResponse(result.withIndices(indexPattern, IndexResolution.empty(indexPattern.indexPattern())));
839839
} else {
840-
indexResolver.resolveAsMergedMappingAndRetrieveMinimumVersion(
840+
indexResolver.resolveIndicesVersioned(
841841
indexPattern.indexPattern(),
842842
result.fieldNames,
843843
// Maybe if no indices are returned, retry without index mode and provide a clearer error message.

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/IndexResolver.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public IndexResolver(Client client) {
8686
/**
8787
* Resolves a pattern to one (potentially compound meaning that spawns multiple indices) mapping.
8888
*/
89-
public void resolveAsMergedMapping(
89+
public void resolveIndices(
9090
String indexWildcard,
9191
Set<String> fieldNames,
9292
QueryBuilder requestFilter,
@@ -95,26 +95,22 @@ public void resolveAsMergedMapping(
9595
boolean useDenseVectorWhenNotSupported,
9696
ActionListener<IndexResolution> listener
9797
) {
98-
ActionListener<Versioned<IndexResolution>> ignoreVersion = listener.delegateFailureAndWrap(
99-
(l, versionedResolution) -> l.onResponse(versionedResolution.inner())
100-
);
101-
102-
resolveAsMergedMappingAndRetrieveMinimumVersion(
98+
resolveIndicesVersioned(
10399
indexWildcard,
104100
fieldNames,
105101
requestFilter,
106102
includeAllDimensions,
107103
useAggregateMetricDoubleWhenNotSupported,
108104
useDenseVectorWhenNotSupported,
109-
ignoreVersion
105+
listener.map(Versioned::inner)
110106
);
111107
}
112108

113109
/**
114110
* Resolves a pattern to one (potentially compound meaning that spawns multiple indices) mapping. Also retrieves the minimum transport
115111
* version available in the cluster (and remotes).
116112
*/
117-
public void resolveAsMergedMappingAndRetrieveMinimumVersion(
113+
public void resolveIndicesVersioned(
118114
String indexWildcard,
119115
Set<String> fieldNames,
120116
QueryBuilder requestFilter,

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/SessionUtils.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010
import org.elasticsearch.common.unit.ByteSizeValue;
1111
import org.elasticsearch.compute.data.Block;
1212
import org.elasticsearch.compute.data.BlockFactory;
13-
import org.elasticsearch.compute.data.BlockUtils;
1413
import org.elasticsearch.compute.data.Page;
1514
import org.elasticsearch.core.Releasables;
1615
import org.elasticsearch.xpack.esql.core.expression.Attribute;
1716
import org.elasticsearch.xpack.esql.planner.PlannerUtils;
1817

19-
import java.util.ArrayList;
2018
import java.util.List;
2119
import java.util.function.LongFunction;
2220

@@ -51,15 +49,4 @@ public static long checkPagesBelowSize(List<Page> pages, ByteSizeValue maxSize,
5149
}
5250
return currentSize;
5351
}
54-
55-
public static List<Object> fromPage(List<Attribute> schema, Page page) {
56-
if (page.getPositionCount() != 1) {
57-
throw new IllegalArgumentException("expected single row");
58-
}
59-
List<Object> values = new ArrayList<>(schema.size());
60-
for (int i = 0; i < schema.size(); i++) {
61-
values.add(BlockUtils.toJavaObject(page.getBlock(i), 0));
62-
}
63-
return values;
64-
}
6552
}

0 commit comments

Comments
 (0)