Skip to content

Commit ea24893

Browse files
committed
default timestamp and output columns
1 parent 8d0f691 commit ea24893

File tree

5 files changed

+170
-151
lines changed

5 files changed

+170
-151
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/change_point.csv-spec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ count:long | @timestamp:datetime | type:keyword | pvalue:double
3333
;
3434

3535

36-
detect spike (long)
36+
detect spike (long; default output columns)
3737
required_capability: change_point
3838

3939
FROM k8s
4040
| STATS count=COUNT() BY @timestamp=BUCKET(@timestamp, 1 MINUTE)
4141
| EVAL count=count+CASE(@timestamp=="2024-05-10T00:08:00.000Z", 100, 0)
42-
| CHANGE_POINT count ON @timestamp AS type, pvalue
42+
| CHANGE_POINT count ON @timestamp
4343
;
4444

4545
@timestamp:datetime | count:long | type:keyword | pvalue:double
@@ -69,13 +69,13 @@ FROM k8s
6969
;
7070

7171

72-
detect step change (long)
72+
detect step change (long; default timestamp)
7373
required_capability: change_point
7474

7575
FROM k8s
7676
| STATS count=COUNT() BY @timestamp=BUCKET(@timestamp, 1 MINUTE)
7777
| EVAL count=count+CASE(@timestamp>="2024-05-10T00:11:00.000Z", 100, 0)
78-
| CHANGE_POINT count ON @timestamp AS type, pvalue
78+
| CHANGE_POINT count AS type, pvalue
7979
;
8080

8181
@timestamp:datetime | count:long | type:keyword | pvalue:double

x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ joinPredicate
340340
: valueExpression
341341
;
342342

343-
// TODO: make ON/AS optional
344343
changePointCommand
345-
: DEV_CHANGE_POINT value=qualifiedName ON key=qualifiedName AS targetType=qualifiedName COMMA targetPvalue=qualifiedName
344+
: DEV_CHANGE_POINT value=qualifiedName (ON key=qualifiedName)? (AS targetType=qualifiedName COMMA targetPvalue=qualifiedName)?
346345
;

0 commit comments

Comments
 (0)