Skip to content

Commit e3b4248

Browse files
committed
avoid unnecessary returns
1 parent dd7be66 commit e3b4248

File tree

1 file changed

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

1 file changed

+7
-12
lines changed

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

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -741,10 +741,8 @@ private static void analyzeAndMaybeRetry(
741741
PreAnalysisResult result,
742742
EsqlExecutionInfo executionInfo,
743743
ActionListener<LogicalPlan> logicalPlanListener,
744-
ActionListener<PreAnalysisResult> l
744+
ActionListener<PreAnalysisResult> stepListener
745745
) {
746-
LogicalPlan plan = null;
747-
748746
var description = requestFilter == null ? "the only attempt without filter" : "first attempt with filter";
749747
LOGGER.debug("Analyzing the plan ({})", description);
750748

@@ -754,25 +752,22 @@ private static void analyzeAndMaybeRetry(
754752
// when the resolution result is not valid for a different reason.
755753
EsqlCCSUtils.updateExecutionInfoWithClustersWithNoMatchingIndices(executionInfo, result.indices, requestFilter != null);
756754
}
757-
plan = analyzeAction.apply(result);
755+
LogicalPlan plan = analyzeAction.apply(result);
756+
LOGGER.debug("Analyzed plan ({}):\n{}", description, plan);
757+
// the analysis succeeded from the first attempt, irrespective if it had a filter or not, just continue with the planning
758+
logicalPlanListener.onResponse(plan);
758759
} catch (VerificationException ve) {
759760
LOGGER.debug("Analyzing the plan ({}) failed with {}", description, ve.getDetailedMessage());
760761
if (requestFilter == null) {
761762
// if the initial request didn't have a filter, then just pass the exception back to the user
762763
logicalPlanListener.onFailure(ve);
763764
} else {
764-
// interested only in a VerificationException, but this time we are taking out the index filter
765-
// to try and make the index resolution work without any index filtering. In the next step... to be continued
766-
l.onResponse(result);
765+
// retrying and make the index resolution work without any index filtering.
766+
stepListener.onResponse(result);
767767
}
768-
return;
769768
} catch (Exception e) {
770769
logicalPlanListener.onFailure(e);
771-
return;
772770
}
773-
LOGGER.debug("Analyzed plan ({}):\n{}", description, plan);
774-
// the analysis succeeded from the first attempt, irrespective if it had a filter or not, just continue with the planning
775-
logicalPlanListener.onResponse(plan);
776771
}
777772

778773
private void resolveInferences(LogicalPlan plan, PreAnalysisResult preAnalysisResult, ActionListener<PreAnalysisResult> l) {

0 commit comments

Comments
 (0)