sdf-jkl commented on code in PR #9965:
URL: https://github.com/apache/arrow-rs/pull/9965#discussion_r3288634287
##########
arrow-arith/src/temporal.rs:
##########
@@ -118,6 +117,8 @@ impl FromStr for DatePart {
"isoweek" => Self::WeekISO,
"d" | "day" | "days" => Self::Day,
"dow" | "dayofweek" => Self::DayOfWeekSunday0,
+ "dayofweek1" => Self::DayOfWeekSunday1,
Review Comment:
It's using the `IntervalUnit` enum that's supposed to match Postgres
`Interval` type.
https://github.com/apache/arrow-rs/blob/2f923f72989ab9df0cb02c749891c5ab3093f743/arrow-cast/src/parse.rs#L1085-L1089
For variants that are not part of this enum we match on string:
```rust
match part_trim.to_lowercase().as_str() {
"isoyear" => date_part(array.as_ref(), DatePart::YearISO)?,
"qtr" | "quarter" => date_part(array.as_ref(),
DatePart::Quarter)?,
"doy" => date_part(array.as_ref(), DatePart::DayOfYear)?,
"dow" => date_part(array.as_ref(),
DatePart::DayOfWeekSunday0)?,
"isodow" => {
```
I proposed replacing the `IntervalUnit` in `date_part` function with the
semantically correct `DatePart` enum that would have all the variants we need.
--
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]