Skip to content

Commit 4ace296

Browse files
committed
Some fixes
1 parent 9c64448 commit 4ace296

File tree

2 files changed

+8
-4
lines changed
  • x-pack/plugin
    • esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate
    • src/yamlRestTest/resources/rest-api-spec/test/esql

2 files changed

+8
-4
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/ChangePoint.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class ChangePoint extends AggregateFunction implements OptionalArgument,
4040
ChangePoint::new
4141
);
4242

43-
@FunctionInfo(returnType = { "string" }, description = "...", isAggregation = true)
43+
@FunctionInfo(returnType = { "string" }, description = "Detects spikes, dips, and change points in a metric", isAggregation = true)
4444
public ChangePoint(
4545
Source source,
4646
@Param(name = "field", type = { "double", "integer", "long" }, description = "field") Expression field,
@@ -73,12 +73,16 @@ Expression timestamp() {
7373

7474
@Override
7575
protected NodeInfo<ChangePoint> info() {
76-
return NodeInfo.create(this, ChangePoint::new, field(), timestamp());
76+
return NodeInfo.create(this, ChangePoint::new, field(), filter(), timestamp());
7777
}
7878

7979
@Override
8080
public ChangePoint replaceChildren(List<Expression> newChildren) {
81-
return new ChangePoint(source(), newChildren.get(0), newChildren.get(1), newChildren.get(2));
81+
if (newChildren.size() == 2) {
82+
return new ChangePoint(source(), newChildren.get(0), newChildren.get(1));
83+
} else {
84+
return new ChangePoint(source(), newChildren.get(0), newChildren.get(1), newChildren.get(2));
85+
}
8286
}
8387

8488
// TODO: this needs to output multiple columns or a composite object

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ setup:
9292
- gt: {esql.functions.to_long: $functions_to_long}
9393
- match: {esql.functions.coalesce: $functions_coalesce}
9494
# Testing for the entire function set isn't feasbile, so we just check that we return the correct count as an approximation.
95-
- length: {esql.functions: 130} # check the "sister" test below for a likely update to the same esql.functions length check
95+
- length: {esql.functions: 131} # check the "sister" test below for a likely update to the same esql.functions length check
9696

9797
---
9898
"Basic ESQL usage output (telemetry) non-snapshot version":

0 commit comments

Comments
 (0)