mustafasrepo commented on code in PR #10614:
URL: https://github.com/apache/datafusion/pull/10614#discussion_r1609659094


##########
datafusion/physical-expr/src/window/lead_lag.rs:
##########
@@ -238,7 +238,10 @@ impl PartitionEvaluator for WindowShiftEvaluator {
             let start = if self.non_null_offsets.len() == self.shift_offset as 
usize {
                 // How many rows needed previous than the current row to get 
necessary lag result
                 let offset: usize = self.non_null_offsets.iter().sum();
-                idx.saturating_sub(offset + 1)
+                idx.saturating_sub(offset)
+            } else if !self.ignore_nulls {
+                let offset = self.shift_offset as usize;
+                idx.saturating_sub(offset)

Review Comment:
   instead of 0, we now return `idx-offset`(can be larger than 0, which will 
trigger pruning) for `LAG`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to