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


##########
datafusion/physical-expr/src/window/lead_lag.rs:
##########
@@ -249,6 +252,9 @@ impl PartitionEvaluator for WindowShiftEvaluator {
                 // How many rows needed further than the current row to get 
necessary lead result
                 let offset: usize = self.non_null_offsets.iter().sum();
                 min(idx + offset + 1, n_rows)
+            } else if !self.ignore_nulls {
+                let offset = (-self.shift_offset) as usize;
+                min(idx + offset, n_rows)

Review Comment:
   instead of `n_rows`, we now return `idx+offset`(can be smaller than 
`n_rows`, which will required less data for correct result) for `LEAD`



-- 
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