Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions server/src/main/java/org/elasticsearch/TransportVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,6 @@ static TransportVersion def(int id) {
public static final TransportVersion ML_INFERENCE_LLAMA_ADDED = def(9_125_0_00);
public static final TransportVersion SHARD_WRITE_LOAD_IN_CLUSTER_INFO = def(9_126_0_00);
public static final TransportVersion ESQL_SAMPLE_OPERATOR_STATUS = def(9_127_0_00);
public static final TransportVersion ALLOCATION_DECISION_NOT_PREFERRED = def(9_145_0_00);
public static final TransportVersion ESQL_QUALIFIERS_IN_ATTRIBUTES = def(9_146_0_00);
public static final TransportVersion PROJECT_RESERVED_STATE_MOVE_TO_REGISTRY = def(9_147_0_00);

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

package org.elasticsearch.cluster.routing.allocation.decider;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;
Expand Down Expand Up @@ -115,8 +115,12 @@ enum Type implements Writeable {
NOT_PREFERRED,
YES;

private static final TransportVersion ALLOCATION_DECISION_NOT_PREFERRED = TransportVersion.fromName(
"allocation_decision_not_preferred"
);

public static Type readFrom(StreamInput in) throws IOException {
if (in.getTransportVersion().onOrAfter(TransportVersions.ALLOCATION_DECISION_NOT_PREFERRED)) {
if (in.getTransportVersion().supports(ALLOCATION_DECISION_NOT_PREFERRED)) {
return in.readEnum(Type.class);
} else {
int i = in.readVInt();
Expand All @@ -138,7 +142,7 @@ public static Type min(Type a, Type b) {

@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getTransportVersion().onOrAfter(TransportVersions.ALLOCATION_DECISION_NOT_PREFERRED)) {
if (out.getTransportVersion().supports(ALLOCATION_DECISION_NOT_PREFERRED)) {
out.writeEnum(this);
} else {
out.writeVInt(switch (this) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9145000
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9146000
2 changes: 1 addition & 1 deletion server/src/main/resources/transport/upper_bounds/9.2.csv
Original file line number Diff line number Diff line change
@@ -1 +1 @@
esql_lookup_operator_emitted_rows,9144000
esql_qualifiers_in_attributes,9146000
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.util.Objects;

import static java.util.Collections.emptyList;
import static org.elasticsearch.TransportVersions.ESQL_QUALIFIERS_IN_ATTRIBUTES;

/**
* {@link Expression}s that can be materialized and describe properties of the derived table.
Expand All @@ -38,6 +37,8 @@ public abstract class Attribute extends NamedExpression {
*/
protected static final String SYNTHETIC_ATTRIBUTE_NAME_PREFIX = "$$";

private static final TransportVersion ESQL_QUALIFIERS_IN_ATTRIBUTES = TransportVersion.fromName("esql_qualifiers_in_attributes");

// can the attr be null
private final Nullability nullability;
private final String qualifier;
Expand Down Expand Up @@ -204,7 +205,7 @@ public static boolean dataTypeEquals(List<Attribute> left, List<Attribute> right
public abstract boolean isDimension();

protected void checkAndSerializeQualifier(PlanStreamOutput out, TransportVersion version) throws IOException {
if (version.onOrAfter(ESQL_QUALIFIERS_IN_ATTRIBUTES)) {
if (version.supports(ESQL_QUALIFIERS_IN_ATTRIBUTES)) {
out.writeOptionalCachedString(qualifier());
} else if (qualifier() != null) {
// Non-null qualifier means the query specifically defined one. Old nodes don't know what to do with it and just writing
Expand All @@ -215,7 +216,7 @@ protected void checkAndSerializeQualifier(PlanStreamOutput out, TransportVersion
}

protected static String readQualifier(PlanStreamInput in, TransportVersion version) throws IOException {
if (version.onOrAfter(ESQL_QUALIFIERS_IN_ATTRIBUTES)) {
if (version.supports(ESQL_QUALIFIERS_IN_ATTRIBUTES)) {
return in.readOptionalCachedString();
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
package org.elasticsearch.xpack.esql.core.expression;

import org.elasticsearch.TransportVersion;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand All @@ -18,8 +19,6 @@

import java.io.IOException;

import static org.elasticsearch.TransportVersions.ESQL_QUALIFIERS_IN_ATTRIBUTES;

/**
* Attribute based on a reference to an expression.
*/
Expand All @@ -30,6 +29,8 @@ public class ReferenceAttribute extends TypedAttribute {
ReferenceAttribute::readFrom
);

private static final TransportVersion ESQL_QUALIFIERS_IN_ATTRIBUTES = TransportVersion.fromName("esql_qualifiers_in_attributes");

@Deprecated
/**
* Only used for tests
Expand Down Expand Up @@ -61,7 +62,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeString(name());
dataType().writeTo(out);
checkAndSerializeQualifier((PlanStreamOutput) out, out.getTransportVersion());
if (out.getTransportVersion().before(ESQL_QUALIFIERS_IN_ATTRIBUTES)) {
if (out.getTransportVersion().supports(ESQL_QUALIFIERS_IN_ATTRIBUTES) == false) {
// We used to always serialize a null qualifier here, so do the same for bwc.
out.writeOptionalString(null);
}
Expand Down Expand Up @@ -89,7 +90,7 @@ private static ReferenceAttribute innerReadFrom(StreamInput in) throws IOExcepti
String name = in.readString();
DataType dataType = DataType.readFrom(in);
String qualifier = readQualifier((PlanStreamInput) in, in.getTransportVersion());
if (in.getTransportVersion().before(ESQL_QUALIFIERS_IN_ATTRIBUTES)) {
if (in.getTransportVersion().supports(ESQL_QUALIFIERS_IN_ATTRIBUTES) == false) {
in.readOptionalString();
}
Nullability nullability = in.readEnum(Nullability.class);
Expand Down