xiedeyantu opened a new pull request, #22250: URL: https://github.com/apache/datafusion/pull/22250
## Which issue does this PR close? Closes #22208. ## Rationale for this change The table-valued `generate_series(start, stop, step)` function uses an integer iterator that called `current += step` without overflow checking. When the series approaches `i64::MAX` and the step would advance past it, Rust's debug build panics and release build silently wraps, producing incorrect results or a crash visible to end users. ## What changes are included in this PR? - In generate_series.rs, replaced the unchecked `*self += step` in the `SeriesValue for i64` `advance` method with `checked_add`, returning a `DataFusionError::Execution` on overflow instead of panicking. - Added a regression test in table_functions.slt that verifies `SELECT * FROM generate_series(9223372036854775806, 9223372036854775807, 2)` returns an execution error rather than panicking. ## Are these changes tested? Yes. A `statement error` case is added to table_functions.slt covering the exact query from the bug report. The timestamp-based `advance` implementation already used `Option`-returning arithmetic and was not affected. ## Are there any user-facing changes? Previously this query would cause a panic (or silent wrap in release mode); it now returns a clean `DataFusion error: Execution error: generate_series: integer overflow while advancing series`. -- 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]
