You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/27 18:18:44 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #2939: Format Timestamps as RFC3339

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


##########
arrow/src/util/display.rs:
##########
@@ -334,17 +358,55 @@ pub fn array_value_to_string(column: &array::ArrayRef, row: usize) -> Result<Str
         DataType::Float32 => make_string!(array::Float32Array, column, row),
         DataType::Float64 => make_string!(array::Float64Array, column, row),
         DataType::Decimal128(..) => make_string_from_decimal(column, row),
-        DataType::Timestamp(unit, _) if *unit == TimeUnit::Second => {
-            make_string_datetime!(array::TimestampSecondArray, column, row)
+        DataType::Timestamp(unit, tz_string_opt) if *unit == TimeUnit::Second => {
+            match tz_string_opt {
+                Some(tz_string) => make_string_datetime_with_tz!(

Review Comment:
   It might be nice to combine the make_string_datetime_with_tz and make_string_datetime macros together?



##########
arrow/src/util/pretty.rs:
##########
@@ -370,13 +370,134 @@ mod tests {
         };
     }
 
+    /// Generate an array with type $ARRAYTYPE with a numeric value of
+    /// $VALUE, and compare $EXPECTED_RESULT to the output of
+    /// formatting that array with `pretty_format_batches`
+    macro_rules! check_datetime_with_timezone {

Review Comment:
   I think passing an optional timezone to check_datetime and calling `with_timezone_opt` would avoid some duplication.
   
   On a related note, I don't think either need to be macros and therefore probably shouldn't be.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org