You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "edubraqd (via GitHub)" <gi...@apache.org> on 2026/09/03 04:09:17 UTC

[PR] fix: do not panic when partitioning a `COPY` by an out-of-range date [datafusion]

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

   ## Which issue does this PR close?
   
   - Closes #24907.
   
   ## Rationale for this change
   
   `compute_partition_keys_by_row` turned `Date32` / `Date64` partition values into `yyyy-mm-dd` path segments with unchecked arithmetic and an `unwrap`, so a value outside the range of `chrono::NaiveDate` panicked the writer task ("attempt to add with overflow" or "called `Option::unwrap()` on a `None` value").
   
   ## What changes are included in this PR?
   
   Use checked conversions and return an execution error naming the value. For `Date64` the milliseconds are converted to days with `div_euclid`, so a value before the epoch lands on the correct calendar day, and the day count is range-checked before it is narrowed to `i32`. The date formatting is shared by both branches.
   
   ## Are these changes tested?
   
   Yes. `copy.slt` now partitions by a date column (including a pre-epoch date) and checks the three out-of-range cases return an error; they used to panic.
   
   ## Are there any user-facing changes?
   
   An out-of-range date in a `PARTITIONED BY` column produces an execution error instead of a panic. A `Date64` value before the epoch is now placed in the correct day's partition.
   


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


Re: [PR] fix: do not panic when partitioning a `COPY` by an out-of-range date [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #24908:
URL: https://github.com/apache/datafusion/pull/24908#issuecomment-5640800609

   Closing per https://github.com/apache/datafusion/pull/24893#issuecomment-5640786567


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


Re: [PR] fix: do not panic when partitioning a `COPY` by an out-of-range date [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed pull request #24908: fix: do not panic when partitioning a `COPY` by an out-of-range date
URL: https://github.com/apache/datafusion/pull/24908


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