@@ -165,8 +165,6 @@ struct FirstValueAccumulator {
165165 orderings : Vec < ScalarValue > ,
166166 // Stores the applicable ordering requirement.
167167 ordering_req : LexOrdering ,
168- // Whether merge_batch() is called before
169- is_merge_called : bool ,
170168}
171169
172170impl FirstValueAccumulator {
@@ -185,7 +183,6 @@ impl FirstValueAccumulator {
185183 is_set : false ,
186184 orderings,
187185 ordering_req,
188- is_merge_called : false ,
189186 } )
190187 }
191188
@@ -201,9 +198,7 @@ impl Accumulator for FirstValueAccumulator {
201198 fn state ( & self ) -> Result < Vec < ScalarValue > > {
202199 let mut result = vec ! [ self . first. clone( ) ] ;
203200 result. extend ( self . orderings . iter ( ) . cloned ( ) ) ;
204- if !self . is_merge_called {
205- result. push ( ScalarValue :: Boolean ( Some ( self . is_set ) ) ) ;
206- }
201+ result. push ( ScalarValue :: Boolean ( Some ( self . is_set ) ) ) ;
207202 Ok ( result)
208203 }
209204
@@ -218,7 +213,6 @@ impl Accumulator for FirstValueAccumulator {
218213 }
219214
220215 fn merge_batch ( & mut self , states : & [ ArrayRef ] ) -> Result < ( ) > {
221- self . is_merge_called = true ;
222216 // FIRST_VALUE(first1, first2, first3, ...)
223217 // last index contains is_set flag.
224218 let is_set_idx = states. len ( ) - 1 ;
@@ -394,8 +388,6 @@ struct LastValueAccumulator {
394388 orderings : Vec < ScalarValue > ,
395389 // Stores the applicable ordering requirement.
396390 ordering_req : LexOrdering ,
397- // Whether merge_batch() is called before
398- is_merge_called : bool ,
399391}
400392
401393impl LastValueAccumulator {
@@ -414,7 +406,6 @@ impl LastValueAccumulator {
414406 is_set : false ,
415407 orderings,
416408 ordering_req,
417- is_merge_called : false ,
418409 } )
419410 }
420411
@@ -430,9 +421,7 @@ impl Accumulator for LastValueAccumulator {
430421 fn state ( & self ) -> Result < Vec < ScalarValue > > {
431422 let mut result = vec ! [ self . last. clone( ) ] ;
432423 result. extend ( self . orderings . clone ( ) ) ;
433- if !self . is_merge_called {
434- result. push ( ScalarValue :: Boolean ( Some ( self . is_set ) ) ) ;
435- }
424+ result. push ( ScalarValue :: Boolean ( Some ( self . is_set ) ) ) ;
436425 Ok ( result)
437426 }
438427
@@ -446,7 +435,6 @@ impl Accumulator for LastValueAccumulator {
446435 }
447436
448437 fn merge_batch ( & mut self , states : & [ ArrayRef ] ) -> Result < ( ) > {
449- self . is_merge_called = true ;
450438 // LAST_VALUE(last1, last2, last3, ...)
451439 // last index contains is_set flag.
452440 let is_set_idx = states. len ( ) - 1 ;
0 commit comments