alamb commented on code in PR #4189:
URL: https://github.com/apache/arrow-datafusion/pull/4189#discussion_r1020753866
##########
datafusion/core/src/datasource/listing/helpers.rs:
##########
@@ -336,6 +336,20 @@ fn batches_to_paths(batches: &[RecordBatch]) ->
Result<Vec<PartitionedFile>> {
.collect()
}
+fn to_timestamp_millis(v: i64) -> Result<chrono::DateTime<Utc>> {
Review Comment:
Likewise, now if an error converting timestamps occurs, DataFusion will make
a real error, not panic
##########
datafusion/common/src/scalar.rs:
##########
@@ -572,7 +572,12 @@ fn do_date_time_math(
scalar: &ScalarValue,
sign: i32,
) -> Result<NaiveDateTime> {
- let prior = NaiveDateTime::from_timestamp(secs, nsecs);
+ let prior = NaiveDateTime::from_timestamp_opt(secs, nsecs).ok_or_else(|| {
Review Comment:
if this fails at runtime, now a real error will be returned rather than panic
##########
datafusion/common/src/scalar.rs:
##########
@@ -525,15 +525,15 @@ macro_rules! get_sign {
#[inline]
pub fn date32_add(days: i32, scalar: &ScalarValue, sign: i32) -> Result<i32> {
- let epoch = NaiveDate::from_ymd(1970, 1, 1);
+ let epoch = NaiveDate::from_ymd_opt(1970, 1, 1).unwrap();
Review Comment:
these are in real code, but they are constants so unwrapping seems fine
--
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]