HaoYang670 opened a new issue #1408:
URL: https://github.com/apache/arrow-rs/issues/1408


   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   
https://github.com/apache/arrow-rs/blob/master/arrow%2Fsrc%2Fcompute%2Fkernels%2Fwindow.rs#L61-L66
   ```rust
       if offset == 0 {
           Ok(make_array(array.data_ref().clone()))
       } else if offset == i64::MIN || abs(offset) >= value_len {
           Ok(new_null_array(array.data_type(), array.len()))
       } else {
           let slice_offset = clamp(-offset, 0, value_len) as usize;
           ...
   ```
   When calculate `slice_offset`, we don't need to compare `-offset` with 
`value_len`, because we have checked `abs(offset) >= value_len` before.
   
   **Describe the solution you'd like**
   `slice_offset` should be `0` when `offset > 0` (shift left) and `-offset` 
when `offset < 0` (shift right).  Maybe we can use `clamp_min`
   
   **Describe alternatives you've considered**
   A clear and concise description of any alternative solutions or features 
you've considered.
   
   **Additional context**
   Add any other context or screenshots about the feature request here.
   


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


Reply via email to