@@ -103,7 +103,7 @@ private void evaluateFinalWithWindow(
103103 GroupingAggregatorFunction finalAggFunction = finalAgg .aggregatorFunction ();
104104 boolean hasNullIntermediateState = addInitialIntermediateInput (finalAggFunction , selected , page );
105105 for (int i = 0 ; i < selected .getPositionCount (); i ++) {
106- groupId = selected .getInt (i );
106+ int groupId = selected .getInt (i );
107107 mergeBucketsFromWindow (groupId , backwards , page , finalAggFunction , evaluationContext , hasNullIntermediateState );
108108 }
109109 } finally {
@@ -174,6 +174,7 @@ private void mergeBucketsFromWindow(
174174 }
175175 }
176176
177+ <<<<<<< HEAD
177178 /**
178179 * Adds the non-null positions of {@code page} as intermediate input to {@code fn}, using
179180 * {@link Block#asVector()} to skip null-checking on dense blocks. Returns whether any null
@@ -189,6 +190,15 @@ private static boolean addInitialIntermediateInput(GroupingAggregatorFunction fn
189190 if (anyNullable == false ) {
190191 fn .addIntermediateInput (0 , groups , page );
191192 return false ;
193+ =======
194+ private static void addNonNullIntermediateInput (GroupingAggregatorFunction fn , IntVector groups , Page page ) {
195+ int [] positions = positionsWithIntermediateState (page );
196+ if (positions .length == 0 ) {
197+ return ;
198+ }
199+ try (IntVector filteredGroups = groups .filter (false , positions ); Page filteredPage = filterPage (page , positions )) {
200+ fn .addIntermediateInput (0 , filteredGroups , filteredPage );
201+ >>>>>>> eca05d24b96 (Add logic to handle time bucket offset in window functions )
192202 }
193203 int [] positions = new int [page .getPositionCount ()];
194204 int count = 0 ;
0 commit comments