File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
main/java/org/elasticsearch/xpack/esql/parser
test/java/org/elasticsearch/xpack/esql/analysis Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -445,7 +445,9 @@ public PlanFactory visitEnrichCommand(EsqlBaseParser.EnrichCommandContext ctx) {
445445 public PlanFactory visitChangePointCommand (EsqlBaseParser .ChangePointCommandContext ctx ) {
446446 Source src = source (ctx );
447447 NamedExpression value = visitQualifiedName (ctx .value );
448- NamedExpression key = ctx .key == null ? new UnresolvedAttribute (src , "@timestamp" ) : visitQualifiedName (ctx .key );
448+ NamedExpression key = ctx .key == null
449+ ? new UnresolvedAttribute (src , "@timestamp" , "Key column unspecified and default [@timestamp] is missing" )
450+ : visitQualifiedName (ctx .key );
449451 Attribute targetType = new ReferenceAttribute (
450452 src ,
451453 ctx .targetType == null ? "type" : visitQualifiedName (ctx .targetType ).name (),
Original file line number Diff line number Diff line change @@ -2021,8 +2021,10 @@ public void testChangePoint() {
20212021 var airports = AnalyzerTestUtils .analyzer (loadMapping ("mapping-airports.json" , "airports" ));
20222022 assertEquals ("1:30: Unknown column [blahblah]" , error ("FROM airports | CHANGE_POINT blahblah ON scalerank" , airports ));
20232023 assertEquals ("1:43: Unknown column [blahblah]" , error ("FROM airports | CHANGE_POINT scalerank ON blahblah" , airports ));
2024- // TODO: nicer error message for missing default column "@timestamp"
2025- assertEquals ("1:17: Unknown column [@timestamp]" , error ("FROM airports | CHANGE_POINT scalerank" , airports ));
2024+ assertEquals (
2025+ "1:17: Key column unspecified and default [@timestamp] is missing" ,
2026+ error ("FROM airports | CHANGE_POINT scalerank" , airports )
2027+ );
20262028 }
20272029
20282030 public void testChangePoint_keySortable () {
You can’t perform that action at this time.
0 commit comments