This is an automated email from the ASF dual-hosted git repository.

dheres pushed a commit to branch maintain_time_zone
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git

commit 8f8140365b994c6607462ccabf488500d752d524
Author: DaniĆ«l Heres <[email protected]>
AuthorDate: Sun Oct 22 00:39:50 2023 +0200

    Maintain time_zone in new_list
---
 datafusion/common/src/scalar.rs | 38 +++++++++++++++++++++++++++++++-------
 parquet-testing                 |  2 +-
 testing                         |  2 +-
 3 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/datafusion/common/src/scalar.rs b/datafusion/common/src/scalar.rs
index 2c3dd4c5ca..be24e2b933 100644
--- a/datafusion/common/src/scalar.rs
+++ b/datafusion/common/src/scalar.rs
@@ -620,26 +620,30 @@ macro_rules! build_timestamp_list {
                         TimestampSecondBuilder,
                         TimestampSecond,
                         values,
-                        $SIZE
+                        $SIZE,
+                        $TIME_ZONE
                     )
                 }
                 TimeUnit::Millisecond => build_values_list_tz!(
                     TimestampMillisecondBuilder,
                     TimestampMillisecond,
                     values,
-                    $SIZE
+                    $SIZE,
+                    $TIME_ZONE
                 ),
                 TimeUnit::Microsecond => build_values_list_tz!(
                     TimestampMicrosecondBuilder,
                     TimestampMicrosecond,
                     values,
-                    $SIZE
+                    $SIZE,
+                    $TIME_ZONE
                 ),
                 TimeUnit::Nanosecond => build_values_list_tz!(
                     TimestampNanosecondBuilder,
                     TimestampNanosecond,
                     values,
-                    $SIZE
+                    $SIZE,
+                    $TIME_ZONE
                 ),
             },
         }
@@ -683,9 +687,10 @@ macro_rules! build_values_list {
 }
 
 macro_rules! build_values_list_tz {
-    ($VALUE_BUILDER_TY:ident, $SCALAR_TY:ident, $VALUES:expr, $SIZE:expr) => {{
-        let mut builder =
-            ListBuilder::new($VALUE_BUILDER_TY::with_capacity($VALUES.len()));
+    ($VALUE_BUILDER_TY:ident, $SCALAR_TY:ident, $VALUES:expr, $SIZE:expr, 
$TIME_ZONE:expr) => {{
+        let mut builder = ListBuilder::new(
+            
$VALUE_BUILDER_TY::with_capacity($VALUES.len()).with_timezone_opt($TIME_ZONE),
+        );
 
         for _ in 0..$SIZE {
             for scalar_value in $VALUES {
@@ -5185,6 +5190,25 @@ mod tests {
         assert_eq!(1, arr.len());
     }
 
+    #[test]
+    fn test_newlist_timestamp_zone() {
+        let s: &'static str = "UTC";
+        let values = vec![ScalarValue::TimestampMillisecond(Some(1), 
Some(s.into()))];
+        let arr = ScalarValue::new_list(
+            &values,
+            &DataType::Timestamp(TimeUnit::Millisecond, Some(s.into())),
+        );
+        assert_eq!(1, arr.len());
+        assert_eq!(
+            arr.data_type(),
+            &DataType::List(Arc::new(Field::new(
+                "item",
+                DataType::Timestamp(TimeUnit::Millisecond, Some(s.into())),
+                true
+            )))
+        );
+    }
+
     fn get_random_timestamps(sample_size: u64) -> Vec<ScalarValue> {
         let vector_size = sample_size;
         let mut timestamp = vec![];
diff --git a/parquet-testing b/parquet-testing
index e45cd23f78..a11fc8f148 160000
--- a/parquet-testing
+++ b/parquet-testing
@@ -1 +1 @@
-Subproject commit e45cd23f784aab3d6bf0701f8f4e621469ed3be7
+Subproject commit a11fc8f148f8a7a89d9281cc0da3eb9d56095fbf
diff --git a/testing b/testing
index 98fceecd02..5bab2f264a 160000
--- a/testing
+++ b/testing
@@ -1 +1 @@
-Subproject commit 98fceecd024dccd2f8a00e32fc144975f218acf4
+Subproject commit 5bab2f264a23f5af68f69ea93d24ef1e8e77fc88

Reply via email to