xudong963 commented on code in PR #27446:
URL: https://github.com/apache/datafusion/pull/27446#discussion_r4795222506
##########
datafusion/functions-window/src/lead_lag.rs:
##########
@@ -689,6 +749,133 @@ impl PartitionEvaluator for WindowShiftEvaluator {
}
}
+ fn evaluate_stateful_array(
+ &self,
+ values: &[ArrayRef],
+ start_idx: usize,
+ num_rows: usize,
+ is_end: bool,
+ ) -> Result<Option<(ArrayRef, Range<usize>)>> {
+ let value = &values[0];
+ debug_assert_eq!(value.len(), num_rows);
+ debug_assert!(start_idx <= num_rows);
+ if !matches!(value.data_type(), DataType::Timestamp(_, Some(_))) {
Review Comment:
why do we need the tz-only gate?
##########
datafusion/functions-window/src/lead_lag.rs:
##########
@@ -689,6 +749,133 @@ impl PartitionEvaluator for WindowShiftEvaluator {
}
}
+ fn evaluate_stateful_array(
+ &self,
+ values: &[ArrayRef],
+ start_idx: usize,
+ num_rows: usize,
+ is_end: bool,
+ ) -> Result<Option<(ArrayRef, Range<usize>)>> {
+ let value = &values[0];
+ debug_assert_eq!(value.len(), num_rows);
+ debug_assert!(start_idx <= num_rows);
+ if !matches!(value.data_type(), DataType::Timestamp(_, Some(_))) {
+ return Ok(None);
+ }
+
+ let mut last_range = start_idx..start_idx;
+ let shift = offset_magnitude(self.shift_offset);
+
+ if shift == 0 {
+ if start_idx < num_rows {
+ last_range = num_rows - 1..num_rows - 1;
+ }
+ return Ok(Some((
+ value.slice(start_idx, num_rows - start_idx),
+ last_range,
+ )));
Review Comment:
the `shift == 0` branch returns `value.slice(..)`. The scalar bounded path
returns default for NULL rows
##########
datafusion/functions-window/src/lead_lag.rs:
##########
@@ -556,6 +561,61 @@ fn shift_with_default_value(
}
}
+fn shift_timestamp_with_null_default(
Review Comment:
do we really need this one?
--
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]