|
15 | 15 | import org.elasticsearch.action.search.ShardSearchFailure; |
16 | 16 | import org.elasticsearch.action.support.SubscribableListener; |
17 | 17 | import org.elasticsearch.common.collect.Iterators; |
18 | | -import org.elasticsearch.common.lucene.BytesRefs; |
19 | 18 | import org.elasticsearch.compute.data.Block; |
20 | 19 | import org.elasticsearch.compute.data.BlockUtils; |
21 | 20 | import org.elasticsearch.compute.data.Page; |
|
46 | 45 | import org.elasticsearch.xpack.esql.analysis.PreAnalyzer; |
47 | 46 | import org.elasticsearch.xpack.esql.analysis.Verifier; |
48 | 47 | import org.elasticsearch.xpack.esql.core.expression.Attribute; |
49 | | -import org.elasticsearch.xpack.esql.core.expression.FoldContext; |
50 | 48 | import org.elasticsearch.xpack.esql.core.expression.ReferenceAttribute; |
51 | 49 | import org.elasticsearch.xpack.esql.core.tree.Source; |
52 | 50 | import org.elasticsearch.xpack.esql.core.type.DataType; |
|
88 | 86 | import java.util.stream.Collectors; |
89 | 87 | import java.util.stream.Stream; |
90 | 88 |
|
| 89 | +import static java.util.stream.Collectors.toSet; |
91 | 90 | import static org.elasticsearch.index.query.QueryBuilders.boolQuery; |
92 | 91 | import static org.elasticsearch.xpack.esql.core.tree.Source.EMPTY; |
93 | 92 | import static org.elasticsearch.xpack.esql.plan.logical.join.InlineJoin.firstSubPlan; |
@@ -382,14 +381,7 @@ public void analyzedPlan( |
382 | 381 | }; |
383 | 382 |
|
384 | 383 | PreAnalyzer.PreAnalysis preAnalysis = preAnalyzer.preAnalyze(parsed); |
385 | | - var unresolvedPolicies = preAnalysis.enriches.stream() |
386 | | - .map( |
387 | | - e -> new EnrichPolicyResolver.UnresolvedPolicy( |
388 | | - BytesRefs.toString(e.policyName().fold(FoldContext.small() /* TODO remove me*/)), |
389 | | - e.mode() |
390 | | - ) |
391 | | - ) |
392 | | - .collect(Collectors.toSet()); |
| 384 | + var unresolvedPolicies = preAnalysis.enriches.stream().map(EnrichPolicyResolver.UnresolvedPolicy::from).collect(toSet()); |
393 | 385 |
|
394 | 386 | EsqlCCSUtils.initCrossClusterState(indicesExpressionGrouper, verifier.licenseState(), preAnalysis.indices, executionInfo); |
395 | 387 |
|
@@ -592,7 +584,7 @@ private IndexResolution checkSingleIndex( |
592 | 584 | ) { |
593 | 585 | // If all indices resolve to the same name, we can use that for BWC |
594 | 586 | // Older clusters only can handle one name in LOOKUP JOIN |
595 | | - var localIndexNames = indexNames.stream().map(n -> RemoteClusterAware.splitIndexName(n)[1]).collect(Collectors.toSet()); |
| 587 | + var localIndexNames = indexNames.stream().map(n -> RemoteClusterAware.splitIndexName(n)[1]).collect(toSet()); |
596 | 588 | if (localIndexNames.size() == 1) { |
597 | 589 | String indexName = localIndexNames.iterator().next(); |
598 | 590 | EsIndex newIndex = new EsIndex(index, lookupIndexResolution.get().mapping(), Map.of(indexName, IndexMode.LOOKUP)); |
|
0 commit comments