Skip to content

Commit 938afb4

Browse files
committed
Merge remote-tracking branch 'elastic/main' into enable-partial-results
2 parents cbb208a + fcfc90e commit 938afb4

File tree

87 files changed

+1322
-725
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1322
-725
lines changed

docs/changelog/120302.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 120302
2+
summary: "ESQL: Enhanced `DATE_TRUNC` with arbitrary intervals"
3+
area: ES|QL
4+
type: enhancement
5+
issues:
6+
- 120094

docs/changelog/125764.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pr: 125764
2+
summary: Fix `ReplaceMissingFieldsWithNull`
3+
area: ES|QL
4+
type: bug
5+
issues:
6+
- 126036
7+
- 121754
8+
- 126030

docs/changelog/125896.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 125896
2+
summary: Support explicit Z/M attributes using WKT geometry
3+
area: Geo
4+
type: enhancement
5+
issues: [123111]

docs/changelog/126191.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 126191
2+
summary: Fix NPE for missing Content Type header in OIDC Authenticator
3+
area: Authentication
4+
type: bug
5+
issues: []

docs/reference/query-languages/esql/_snippets/functions/description/date_trunc.md

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/_snippets/functions/examples/bucket.md

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/kibana/definition/functions/date_trunc.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/kibana/docs/functions/date_trunc.md

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/geo/src/main/java/org/elasticsearch/geometry/utils/WellKnownText.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public class WellKnownText {
4444
public static final String RPAREN = ")";
4545
public static final String COMMA = ",";
4646
public static final String NAN = "NaN";
47+
public static final String Z = "Z";
48+
public static final String M = "M";
4749
public static final int MAX_NESTED_DEPTH = 1000;
4850

4951
private static final String NUMBER = "<NUMBER>";
@@ -440,7 +442,8 @@ public static Geometry fromWKT(GeometryValidator validator, boolean coerce, Stri
440442
*/
441443
private static Geometry parseGeometry(StreamTokenizer stream, boolean coerce, int depth) throws IOException, ParseException {
442444
final String type = nextWord(stream).toLowerCase(Locale.ROOT);
443-
return switch (type) {
445+
final boolean isExplicitlySpecifiesZorM = isZOrMNext(stream);
446+
Geometry geometry = switch (type) {
444447
case "point" -> parsePoint(stream);
445448
case "multipoint" -> parseMultiPoint(stream);
446449
case "linestring" -> parseLine(stream);
@@ -453,6 +456,16 @@ private static Geometry parseGeometry(StreamTokenizer stream, boolean coerce, in
453456
parseCircle(stream);
454457
default -> throw new IllegalArgumentException("Unknown geometry type: " + type);
455458
};
459+
checkZorMAttribute(isExplicitlySpecifiesZorM, geometry.hasZ());
460+
return geometry;
461+
}
462+
463+
private static void checkZorMAttribute(boolean isExplicitlySpecifiesZorM, boolean hasZ) {
464+
if (isExplicitlySpecifiesZorM && hasZ == false) {
465+
throw new IllegalArgumentException(
466+
"When specifying 'Z' or 'M', coordinates must include three values. Only two coordinates were provided"
467+
);
468+
}
456469
}
457470

458471
private static GeometryCollection<Geometry> parseGeometryCollection(StreamTokenizer stream, boolean coerce, int depth)
@@ -710,6 +723,21 @@ private static boolean isNumberNext(StreamTokenizer stream) throws IOException {
710723
return type == StreamTokenizer.TT_WORD;
711724
}
712725

726+
private static boolean isZOrMNext(StreamTokenizer stream) {
727+
String token;
728+
try {
729+
token = nextWord(stream);
730+
if (token.equals(Z) || token.equals(M)) {
731+
return true;
732+
}
733+
stream.pushBack();
734+
return false;
735+
} catch (ParseException | IOException e) {
736+
return false;
737+
}
738+
739+
}
740+
713741
private static String nextEmptyOrOpen(StreamTokenizer stream) throws IOException, ParseException {
714742
final String next = nextWord(stream);
715743
if (next.equals(EMPTY) || next.equals(LPAREN)) {

libs/geo/src/test/java/org/elasticsearch/geometry/BaseGeometryTestCase.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
abstract class BaseGeometryTestCase<T extends Geometry> extends AbstractWireTestCase<T> {
2323

24+
public static final String ZorMMustIncludeThreeValuesMsg =
25+
"When specifying 'Z' or 'M', coordinates must include three values. Only two coordinates were provided";
26+
2427
@Override
2528
protected final T createTestInstance() {
2629
boolean hasAlt = randomBoolean();

0 commit comments

Comments
 (0)