viirya opened a new pull request, #25520:
URL: https://github.com/apache/datafusion/pull/25520

   ## Which issue does this PR close?
   
   N/A
   
   ## Rationale for this change
   
   Timestamp and date interval steps contain independent month, day, and
   nanosecond components. When those components have mixed signs, the effective
   direction can depend on the current calendar date.
   
   For example, adding `INTERVAL '1 MONTH -29 DAY'` to `2024-01-31` produces the
   same date. Such steps could cause `generate_series` and `range` to return an
   empty result unexpectedly or fail to terminate.
   
   ## What changes are included in this PR?
   
   Following DuckDB's behavior, reject interval steps containing both positive 
and
   negative components.
   
   The validation applies consistently to:
   
   - Scalar/list and table-function forms
   - `generate_series` and `range`
   - DATE and TIMESTAMP arguments
   
   Zero-step and same-sign interval behavior remains unchanged.
   
   ## What is the testing strategy for this PR?
   
   - Added unit tests for positive, negative, and mixed-sign interval 
components.
   - Added SQL logic tests covering both mixed-sign directions.
   - Tested scalar/list and table-function forms.
   - Ran `cargo fmt --all`.
   - Ran Clippy with `-D warnings` for both affected crates.
   - Ran the relevant `table_functions.slt` and `array_range.slt` tests.
   
   ## Are there any user-facing changes?
   
   Yes. Mixed-sign interval steps are now rejected with an error instead of
   potentially returning an unexpected empty result or producing a 
non-terminating
   series.
   
   There are no public API changes.


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