@@ -117,7 +117,7 @@ public void testKSigmaDefaultWindowIsConsistent() throws Exception {
117117 kSigma .validate (new UDFParameterValidator (parameters ));
118118 kSigma .beforeStart (parameters , new UDTFConfigurations (ZoneId .systemDefault ()));
119119
120- Assert .assertEquals (10 , getWindowSize (kSigma ));
120+ Assert .assertEquals (10000 , getWindowSize (kSigma ));
121121 }
122122
123123 @ Test
@@ -134,6 +134,26 @@ public void testKSigmaExplicitWindowOverridesDefault() throws Exception {
134134 Assert .assertEquals (3 , getWindowSize (kSigma ));
135135 }
136136
137+ @ Test
138+ public void testKSigmaDefaultWindowMatchesAnomalyITExpectation () throws Exception {
139+ Map <String , String > attributes = new HashMap <>();
140+ attributes .put ("k" , "1.0" );
141+ UDFParameters parameters = createSingleDoubleSeriesParameters (attributes );
142+ UDTFKSigma kSigma = new UDTFKSigma ();
143+ RecordingPointCollector collector = new RecordingPointCollector ();
144+
145+ kSigma .validate (new UDFParameterValidator (parameters ));
146+ kSigma .beforeStart (parameters , new UDTFConfigurations (ZoneId .systemDefault ()));
147+ double [] values = {0 , 50 , 100 , 150 , 200 , 200 , 200 , 200 , 200 , 200 , 150 , 100 , 50 , 0 };
148+ for (int i = 0 ; i < values .length ; i ++) {
149+ kSigma .transform (new DoubleRow ((i + 1 ) * 100L , values [i ]), collector );
150+ }
151+ kSigma .terminate (collector );
152+
153+ Assert .assertEquals (Arrays .asList (100L , 200L , 1300L , 1400L ), collector .timestamps );
154+ Assert .assertEquals (Arrays .asList (0.0 , 50.0 , 50.0 , 0.0 ), collector .values );
155+ }
156+
137157 @ Test
138158 public void testMvAvgUsesRunningWindowSum () throws Exception {
139159 Map <String , String > attributes = new HashMap <>();
0 commit comments