@@ -57,11 +57,11 @@ public PredictLinear(
5757 }
5858
5959 public PredictLinear (Source source , Expression field , Expression timestamp , Expression t ) {
60- this (source , field , Literal .TRUE , timestamp , t );
60+ this (source , field , Literal .TRUE , NO_WINDOW , timestamp , t );
6161 }
6262
63- public PredictLinear (Source source , Expression field , Expression filter , Expression timestamp , Expression t ) {
64- super (source , field , filter , NO_WINDOW , List .of (timestamp , t ));
63+ public PredictLinear (Source source , Expression field , Expression filter , Expression window , Expression timestamp , Expression t ) {
64+ super (source , field , filter , window , List .of (timestamp , t ));
6565 this .timestamp = timestamp ;
6666 this .t = t ;
6767 }
@@ -72,6 +72,7 @@ private PredictLinear(org.elasticsearch.common.io.stream.StreamInput in) throws
7272 in .readNamedWriteable (Expression .class ),
7373 in .readNamedWriteable (Expression .class ),
7474 in .readNamedWriteable (Expression .class ),
75+ in .readNamedWriteable (Expression .class ),
7576 in .readNamedWriteable (Expression .class )
7677 );
7778 }
@@ -83,7 +84,7 @@ public AggregateFunction perTimeSeriesAggregation() {
8384
8485 @ Override
8586 public AggregateFunction withFilter (Expression filter ) {
86- return new PredictLinear (source (), field (), filter , timestamp , t );
87+ return new PredictLinear (source (), field (), filter , window (), timestamp , t );
8788 }
8889
8990 @ Override
@@ -93,19 +94,19 @@ public DataType dataType() {
9394
9495 @ Override
9596 public Expression replaceChildren (List <Expression > newChildren ) {
96- if (newChildren .size () == 4 ) {
97- return new PredictLinear (source (), newChildren .get (0 ), newChildren .get (1 ), newChildren .get (2 ), newChildren .get (3 ));
98- } else if (newChildren .size () == 3 ) {
99- return new PredictLinear (source (), newChildren .get (0 ), newChildren .get (1 ), newChildren .get (2 ));
97+ if (newChildren .size () == 5 ) {
98+ return new PredictLinear (source (), newChildren .get (0 ), newChildren .get (1 ), newChildren .get (2 ), newChildren .get (3 ), newChildren . get ( 4 ) );
99+ } else if (newChildren .size () == 4 ) {
100+ return new PredictLinear (source (), newChildren .get (0 ), newChildren .get (1 ), newChildren .get (2 ), timestamp , newChildren . get ( 3 ) );
100101 } else {
101- assert newChildren .size () == 2 ;
102+ assert newChildren .size () == 2 : "Received unexpected number of child expressionst " + newChildren . size () ;
102103 return new PredictLinear (source (), newChildren .get (0 ), newChildren .get (1 ));
103104 }
104105 }
105106
106107 @ Override
107108 protected NodeInfo <? extends Expression > info () {
108- return NodeInfo .create (this , PredictLinear ::new , field (), filter (), timestamp , t );
109+ return NodeInfo .create (this , PredictLinear ::new , field (), filter (), window (), timestamp , t );
109110 }
110111
111112 @ Override
0 commit comments