Skip to content

Commit b11bb27

Browse files
authored
ESQL: More explanation for version (#107363)
This explains the ESQL version a bit and adds the magic `@UpateForV9` annotation which has the power to control humans! It'll cause the humans running the 9.0.0 release to read the docs on this class and update the base version in the es-specification.
1 parent 5266f79 commit b11bb27

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/ConsumeProcessor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public Set<String> getSupportedAnnotationTypes() {
4141
"org.elasticsearch.xpack.esql.expression.function.Param",
4242
"org.elasticsearch.rest.ServerlessScope",
4343
"org.elasticsearch.xcontent.ParserConstructor",
44+
"org.elasticsearch.core.UpdateForV9",
4445
Fixed.class.getName()
4546
);
4647
}

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,51 @@
99

1010
import org.elasticsearch.common.Strings;
1111
import org.elasticsearch.common.VersionId;
12+
import org.elasticsearch.core.UpdateForV9;
13+
import org.elasticsearch.xpack.esql.expression.function.scalar.multivalue.MvAvg;
1214

1315
import java.util.Arrays;
1416
import java.util.Comparator;
1517
import java.util.LinkedHashMap;
1618
import java.util.Map;
1719

20+
/**
21+
* The version of the ESQL language being processed.
22+
* <p>
23+
* ESQL is a young language and we don't have the benefit of self-hosting
24+
* its compiler. So we're going to make a lot of mistakes when designing it.
25+
* As such, we expect it to change in backwards incompatible ways several
26+
* times in 2024 and 2025. Hopefully we'll have learned our lesson and we'll
27+
* settle down to one change every couple of years after that.
28+
* </p>
29+
* <p>
30+
* For example, maybe we realize we've made a mistake with the {@link MvAvg}
31+
* function and decide it should return the type of its input field rather
32+
* than always returning a {@code double}. If we decide to make this change
33+
* we'd have to bump the language version. We plan to batch changes like this
34+
* into the {@link EsqlVersion#SNAPSHOT} version for a while and from time to
35+
* time release them as a new version.
36+
* </p>
37+
* <p>
38+
* We require a version to be sent on every request to the ESQL APIs so
39+
* changing the version of a query is always opt-in. There is no REST request
40+
* you can send to any ESQL endpoint that will default to a version of ESQL.
41+
* That means we can release new versions of ESQL in a minor release of
42+
* Elasticsearch. We can and we will.
43+
* </p>
44+
* <p>
45+
* So users of Elasticsearch's clients don't need to think about the version
46+
* of ESQL when they are getting started they we have a concept of "base version".
47+
* This "base version" will remain constant for an entire major release of
48+
* Elasticsearch and clients will send that version with ESQL requests unless
49+
* otherwise configured.
50+
* </p>
51+
* <p>
52+
* This is marked with {@link UpdateForV9} to remind us that we need to
53+
* update the "base version" of ESQL in the client specification when
54+
* we cut a new major. We'll need to do that on every major - and also bump the {@link UpdateForV9} annotation.
55+
* </p>
56+
*/
1857
public enum EsqlVersion implements VersionId<EsqlVersion> {
1958
/**
2059
* Breaking changes go here until the next version is released.

0 commit comments

Comments
 (0)