tustvold commented on code in PR #4557:
URL: https://github.com/apache/arrow-rs/pull/4557#discussion_r1271116692


##########
arrow-cast/src/display.rs:
##########
@@ -534,20 +534,20 @@ temporal_display!(time64us_to_time, time_format, 
Time64MicrosecondType);
 temporal_display!(time64ns_to_time, time_format, Time64NanosecondType);
 
 macro_rules! duration_display {
-    ($convert:ident, $t:ty) => {
+    ($unit:expr, $t:ty) => {
         impl<'a> DisplayIndex for &'a PrimitiveArray<$t> {
             fn write(&self, idx: usize, f: &mut dyn Write) -> FormatResult {
-                write!(f, "{}", $convert(self.value(idx)))?;
+                write!(f, concat!("{} ", $unit), self.value(idx))?;
                 Ok(())
             }
         }
     };
 }
 
-duration_display!(duration_s_to_duration, DurationSecondType);
-duration_display!(duration_ms_to_duration, DurationMillisecondType);
-duration_display!(duration_us_to_duration, DurationMicrosecondType);
-duration_display!(duration_ns_to_duration, DurationNanosecondType);
+duration_display!("secs", DurationSecondType);
+duration_display!("millis", DurationMillisecondType);
+duration_display!("micros", DurationMicrosecondType);
+duration_display!("nanos", DurationNanosecondType);

Review Comment:
   I'm not hugely wedded to this format and welcome alternative suggestions. I 
think faithfully producing the unit of the duration is important, and 
distinguishes durations from intervals, but otherwise I have no strong opinions



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