Skip to content

Commit bca0067

Browse files
committed
attempt to narrow down issue
1 parent 508c6f8 commit bca0067

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ public interface PlanRunner {
112112
private final PreAnalyzer preAnalyzer;
113113
private final Verifier verifier;
114114
private final EsqlFunctionRegistry functionRegistry;
115-
private final LogicalPlanPreOptimizer logicalPlanPreOptimizer;
115+
protected final LogicalPlanPreOptimizer logicalPlanPreOptimizer;
116116
private final LogicalPlanOptimizer logicalPlanOptimizer;
117-
private final PreMapper preMapper;
117+
protected final PreMapper preMapper;
118118

119119
private final Mapper mapper;
120120
private final PhysicalPlanOptimizer physicalPlanOptimizer;
@@ -204,7 +204,7 @@ public void optimizeAndExecute(
204204
* Execute an analyzed plan. Most code should prefer calling {@link #execute} but
205205
* this is public for testing.
206206
*/
207-
private void executeOptimizedPlan(
207+
protected void executeOptimizedPlan(
208208
EsqlQueryRequest request,
209209
EsqlExecutionInfo executionInfo,
210210
PlanRunner planRunner,
@@ -804,7 +804,7 @@ private PhysicalPlan logicalPlanToPhysicalPlan(LogicalPlan optimizedPlan, EsqlQu
804804
return EstimatesRowSize.estimateRowSize(0, physicalPlan);
805805
}
806806

807-
private LogicalPlan optimizedPlan(LogicalPlan logicalPlan) {
807+
protected LogicalPlan optimizedPlan(LogicalPlan logicalPlan) {
808808
if (logicalPlan.preOptimized() == false) {
809809
throw new IllegalStateException("Expected pre-optimized plan");
810810
}

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/CsvTests.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.elasticsearch.Version;
1414
import org.elasticsearch.action.ActionListener;
1515
import org.elasticsearch.action.support.PlainActionFuture;
16+
import org.elasticsearch.action.support.SubscribableListener;
1617
import org.elasticsearch.common.Randomness;
1718
import org.elasticsearch.common.breaker.CircuitBreaker;
1819
import org.elasticsearch.common.collect.Iterators;
@@ -592,7 +593,22 @@ private ActualResults executePlan(BigArrays bigArrays) throws Exception {
592593
new PlanTelemetry(functionRegistry),
593594
null,
594595
EsqlTestUtils.MOCK_TRANSPORT_ACTION_SERVICES
595-
);
596+
) {
597+
@Override
598+
public void optimizeAndExecute(
599+
EsqlQueryRequest request,
600+
EsqlExecutionInfo executionInfo,
601+
PlanRunner planRunner,
602+
LogicalPlan analyzedPlan,
603+
ActionListener<Result> listener
604+
) {
605+
SubscribableListener.<LogicalPlan>newForked(l -> logicalPlanPreOptimizer.preOptimize(analyzedPlan, l))
606+
.andThenApply(this::optimizedPlan)
607+
// .<LogicalPlan>andThen((l, p) -> preMapper.preMapper(p, l))
608+
.<Result>andThen((l, p) -> executeOptimizedPlan(request, executionInfo, planRunner, p, l))
609+
.addListener(listener);
610+
}
611+
};
596612
TestPhysicalOperationProviders physicalOperationProviders = testOperationProviders(foldCtx, testDatasets);
597613

598614
PlainActionFuture<ActualResults> listener = new PlainActionFuture<>();

0 commit comments

Comments
 (0)