Skip to content

Commit

Permalink
Restore V_8_500_014 executionHint serialization. (#96965)
Browse files Browse the repository at this point in the history
This was replaced by optional serialization in version
V_8_500_018 (#96943), breaking backwards compatibility for serverless.

Related to #95903
  • Loading branch information
kkrik-es authored Jun 20, 2023
1 parent 56037c2 commit d6ff43b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public MedianAbsoluteDeviationAggregationBuilder(StreamInput in) throws IOExcept
compression = in.readDouble();
if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_018)) {
executionHint = in.readOptionalWriteable(TDigestExecutionHint::readFrom);
} else if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_014)) {
executionHint = TDigestExecutionHint.readFrom(in);
} else {
executionHint = TDigestExecutionHint.HIGH_ACCURACY;
}
Expand Down Expand Up @@ -128,6 +130,8 @@ protected void innerWriteTo(StreamOutput out) throws IOException {
out.writeDouble(compression);
if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_500_018)) {
out.writeOptionalWriteable(executionHint);
} else if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_500_014)) {
(executionHint == null ? TDigestExecutionHint.DEFAULT : executionHint).writeTo(out);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ public TDigest(double compression, TDigestExecutionHint executionHint) {
TDigest(StreamInput in) throws IOException {
this(
in.readDouble(),
in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_018)
? in.readOptionalWriteable(TDigestExecutionHint::readFrom)
in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_018) ? in.readOptionalWriteable(TDigestExecutionHint::readFrom)
: in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_014) ? TDigestExecutionHint.readFrom(in)
: TDigestExecutionHint.HIGH_ACCURACY
);
}
Expand Down Expand Up @@ -250,6 +250,8 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeDouble(compression);
if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_500_018)) {
out.writeOptionalWriteable(executionHint);
} else if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_500_014)) {
(executionHint == null ? TDigestExecutionHint.DEFAULT : executionHint).writeTo(out);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public BoxplotAggregationBuilder(StreamInput in) throws IOException {
compression = in.readDouble();
if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_018)) {
executionHint = in.readOptionalWriteable(TDigestExecutionHint::readFrom);
} else if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_500_014)) {
executionHint = TDigestExecutionHint.readFrom(in);
} else {
executionHint = TDigestExecutionHint.HIGH_ACCURACY;
}
Expand All @@ -99,6 +101,8 @@ protected void innerWriteTo(StreamOutput out) throws IOException {
out.writeDouble(compression);
if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_500_018)) {
out.writeOptionalWriteable(executionHint);
} else if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_500_014)) {
(executionHint == null ? TDigestExecutionHint.DEFAULT : executionHint).writeTo(out);
}
}

Expand Down

0 comments on commit d6ff43b

Please sign in to comment.