ovr commented on code in PR #2052:
URL: https://github.com/apache/arrow-rs/pull/2052#discussion_r919219794


##########
arrow/src/compute/kernels/temporal.rs:
##########
@@ -112,32 +112,62 @@ macro_rules! return_compute_error_with {
     };
 }
 
-trait ChronoDateQuarter {
+// Internal trait, which is used for mapping values from DateLike structures
+trait ChronoDateExt {
     /// Returns a value in range `1..=4` indicating the quarter this date 
falls into
     fn quarter(&self) -> u32;
 
     /// Returns a value in range `0..=3` indicating the quarter (zero-based) 
this date falls into
     fn quarter0(&self) -> u32;
+
+    fn weekday_from_sunday(&self) -> i32;
 }
 
-impl ChronoDateQuarter for NaiveDateTime {
+impl<T: Datelike> ChronoDateExt for T {
     fn quarter(&self) -> u32 {
         self.quarter0() + 1
     }
 
     fn quarter0(&self) -> u32 {
         self.month0() / 3
     }
-}
 
-impl ChronoDateQuarter for NaiveDate {
-    fn quarter(&self) -> u32 {
-        self.quarter0() + 1
+    fn weekday_from_sunday(&self) -> i32 {
+        self.weekday().num_days_from_sunday() as i32
     }
+}
 
-    fn quarter0(&self) -> u32 {
-        self.month0() / 3
+/// Extracts the day of week of a given temporal array as an array of integers

Review Comment:
   Oops! Sorry, I didnt saw your commit suggestion while I was working on the 
update for PR.
   
   <img width="648" alt="image" 
src="https://user-images.githubusercontent.com/572096/178552505-9c3c3414-8d52-4ccf-82fa-566555ff51bb.png";>
   
   Anyway, if you think that updated comment is inadequate, feel free to add 
addition, I'll commit it.
   
   Thanks



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

Reply via email to