Skip to content

Commit 9a09236

Browse files
committed
Profile serialization
1 parent bd1567c commit 9a09236

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,9 @@ public Profile(StreamInput in) throws IOException {
375375
@Override
376376
public void writeTo(StreamOutput out) throws IOException {
377377
out.writeCollection(drivers);
378+
if (out.getTransportVersion().onOrAfter(TransportVersions.ESQL_PLANNER_PROFILE)) {
379+
out.writeCollection(plannerProfile);
380+
}
378381
}
379382

380383
@Override

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/PlannerProfile.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,22 @@
2222
*/
2323
public class PlannerProfile implements Writeable, ChunkedToXContentObject {
2424

25-
public static final PlannerProfile EMPTY = new PlannerProfile();
25+
public static final PlannerProfile EMPTY = new PlannerProfile(false);
2626

2727
private final boolean isLocalPlanning;
2828

2929
public static PlannerProfile readFrom(StreamInput in) throws IOException {
30-
// NOCOMMIT
31-
throw new UnsupportedOperationException();
30+
boolean isLocalPlanning = in.readBoolean();
31+
return new PlannerProfile(isLocalPlanning);
3232
}
3333

34-
public PlannerProfile() {
35-
// NOCOMMIT
36-
throw new UnsupportedOperationException();
34+
public PlannerProfile(boolean isLocalPlanning) {
35+
this.isLocalPlanning = isLocalPlanning;
3736
}
3837

3938
@Override
4039
public void writeTo(StreamOutput out) throws IOException {
41-
// NOCOMMIT
42-
throw new UnsupportedOperationException();
40+
out.writeBoolean(isLocalPlanning);
4341
}
4442

4543
@Override

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ public SourceProvider createSourceProvider() {
369369
);
370370
}
371371
final List<Driver> drivers;
372-
final PlannerProfile localPlannerProfile = new PlannerProfile();
372+
final PlannerProfile localPlannerProfile = new PlannerProfile(true);
373373
try {
374374
LocalExecutionPlanner planner = new LocalExecutionPlanner(
375375
context.sessionId(),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public EsqlSession(
148148
this.logicalPlanOptimizer = logicalPlanOptimizer;
149149
this.physicalPlanOptimizer = new PhysicalPlanOptimizer(new PhysicalOptimizerContext(configuration));
150150
this.planTelemetry = planTelemetry;
151-
this.plannerProfile = new PlannerProfile();
151+
this.plannerProfile = new PlannerProfile(false);
152152
this.indicesExpressionGrouper = indicesExpressionGrouper;
153153
this.preMapper = new PreMapper(services);
154154
}

0 commit comments

Comments
 (0)