alamb commented on code in PR #4513:
URL: https://github.com/apache/arrow-rs/pull/4513#discussion_r1263068475
##########
arrow-cast/src/cast.rs:
##########
@@ -7823,7 +7420,7 @@ mod tests {
let a = StringArray::from(vec![
"2000-01-01", // valid date with leading 0s
- "2000-2-2", // valid date without leading 0s
+ "2000-2-2", // invalid date without leading 0s
Review Comment:
I think we should continue to treat such strings as valid dates as I think
it is very common in the real world
For example, postgres recognizes it as a date as well
```
postgres=# select '2000-2-2'::date;
date
------------
2000-02-02
(1 row)
```
Not that postgres is the be-all end/all data system but I think it is
illustrative that that format is not some fringe case.
##########
arrow-cast/src/cast.rs:
##########
@@ -7841,17 +7438,12 @@ mod tests {
assert!(c.is_valid(0)); // "2000-01-01"
assert_eq!(date_value, c.value(0));
- let date_value = since(
- NaiveDate::from_ymd_opt(2000, 2, 2).unwrap(),
- from_ymd(1970, 1, 1).unwrap(),
- )
- .num_days() as i32;
- assert!(c.is_valid(1)); // "2000-2-2"
- assert_eq!(date_value, c.value(1));
+ assert!(!c.is_valid(1)); // "2000-2-2"
// test invalid inputs
assert!(!c.is_valid(2)); // "2000-00-00"
- assert!(!c.is_valid(3)); // "2000-01-01T12:00:00"
+ assert!(c.is_valid(3)); // "2000-01-01T12:00:00"
Review Comment:
While surprising that this is a supported "Date" I understanding why
--
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]