You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "Dandandan (via GitHub)" <gi...@apache.org> on 2026/05/15 20:55:43 UTC

[I] panic: lead window function subtracts past i64::MIN with i64::MAX offset [datafusion]

Dandandan opened a new issue, #22231:
URL: https://github.com/apache/datafusion/issues/22231

   ### Describe the bug
   
   `lead` panics during execution when given `i64::MAX` as the offset. The
   LEAD branch computes `(range.start as i64 - self.shift_offset) as usize`,
   which subtracts past `i64::MIN` when `shift_offset = i64::MAX`.
   
   This is the symmetric case of #22221 (which reports `i64::MIN` panicking
   during planning via negation). The `i64::MAX` value reaches the execution
   path instead, panics with a different message at a different line, so
   filing separately — same area, probably the same fix.
   
   ### To Reproduce
   
   ```sql
   SELECT lead(x, 9223372036854775807) OVER (ORDER BY x ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
   FROM (VALUES (1),(2),(3)) AS t(x);
   ```
   
   ### Actual behavior
   
   ```text
   thread 'main' panicked at datafusion/functions-window/src/lead_lag.rs:556:13:
   attempt to subtract with overflow
   ```
   
   ### Expected behavior
   
   Return an execution error for an invalid offset, not a panic.
   
   ### Notes
   
   Source: https://github.com/apache/datafusion/blob/53.1.0/datafusion/functions-window/src/lead_lag.rs#L556
   
   Found via LLM-guided fuzz testing on DataFusion 53.1.0.
   


-- 
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: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] panic: lead window function subtracts past i64::MIN with i64::MAX offset [datafusion]

Posted by "Dandandan (via GitHub)" <gi...@apache.org>.
Dandandan closed issue #22231: panic: lead window function subtracts past i64::MIN with i64::MAX offset
URL: https://github.com/apache/datafusion/issues/22231


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org