Skip to content

Commit 7b09002

Browse files
committed
Simplify esql session
1 parent c65f94d commit 7b09002

File tree

1 file changed

+7
-15
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session

1 file changed

+7
-15
lines changed

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

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
import org.elasticsearch.xpack.esql.plan.IndexPattern;
6565
import org.elasticsearch.xpack.esql.plan.logical.Explain;
6666
import org.elasticsearch.xpack.esql.plan.logical.LogicalPlan;
67-
import org.elasticsearch.xpack.esql.plan.logical.inference.InferencePlan;
6867
import org.elasticsearch.xpack.esql.plan.logical.join.InlineJoin;
6968
import org.elasticsearch.xpack.esql.plan.logical.local.LocalRelation;
7069
import org.elasticsearch.xpack.esql.plan.logical.local.LocalSupplier;
@@ -388,8 +387,13 @@ public void analyzedPlan(
388387
var listener = SubscribableListener.<EnrichResolution>newForked(
389388
l -> enrichPolicyResolver.resolvePolicies(unresolvedPolicies, executionInfo, l)
390389
)
391-
.<PreAnalysisResult>andThen((l, enrichResolution) -> resolveFieldNames(parsed, enrichResolution, l))
392-
.<PreAnalysisResult>andThen((l, preAnalysisResult) -> resolveInferences(preAnalysis.inferencePlans, preAnalysisResult, l));
390+
.<PreAnalysisResult>andThenApply(enrichResolution -> FieldNameUtils.resolveFieldNames(parsed, enrichResolution))
391+
.<PreAnalysisResult>andThen(
392+
(l, preAnalysisResult) -> inferenceRunner.resolveInferenceIds(
393+
preAnalysis.inferencePlans,
394+
l.map(preAnalysisResult::withInferenceResolution)
395+
)
396+
);
393397
// first resolve the lookup indices, then the main indices
394398
for (var index : preAnalysis.lookupIndices) {
395399
listener = listener.andThen((l, preAnalysisResult) -> preAnalyzeLookupIndex(index, preAnalysisResult, executionInfo, l));
@@ -742,18 +746,6 @@ private static void analyzeAndMaybeRetry(
742746
logicalPlanListener.onResponse(plan);
743747
}
744748

745-
private static void resolveFieldNames(LogicalPlan parsed, EnrichResolution enrichResolution, ActionListener<PreAnalysisResult> l) {
746-
ActionListener.completeWith(l, () -> FieldNameUtils.resolveFieldNames(parsed, enrichResolution));
747-
}
748-
749-
private void resolveInferences(
750-
List<InferencePlan<?>> inferencePlans,
751-
PreAnalysisResult preAnalysisResult,
752-
ActionListener<PreAnalysisResult> l
753-
) {
754-
inferenceRunner.resolveInferenceIds(inferencePlans, l.map(preAnalysisResult::withInferenceResolution));
755-
}
756-
757749
private PhysicalPlan logicalPlanToPhysicalPlan(LogicalPlan optimizedPlan, EsqlQueryRequest request) {
758750
PhysicalPlan physicalPlan = optimizedPhysicalPlan(optimizedPlan);
759751
physicalPlan = physicalPlan.transformUp(FragmentExec.class, f -> {

0 commit comments

Comments
 (0)