@@ -118,23 +118,33 @@ pub fn create_random_array(
118
118
size,
119
119
primitive_null_density,
120
120
) ) ,
121
- Timestamp ( unit, _) => {
122
- match unit {
123
- TimeUnit :: Second => Arc :: new ( create_random_temporal_array :: < TimestampSecondType > (
121
+ Timestamp ( unit, tz) => match unit {
122
+ TimeUnit :: Second => Arc :: new (
123
+ create_random_temporal_array :: < TimestampSecondType > ( size, primitive_null_density)
124
+ . with_timezone_opt ( tz. clone ( ) ) ,
125
+ ) ,
126
+ TimeUnit :: Millisecond => Arc :: new (
127
+ create_random_temporal_array :: < TimestampMillisecondType > (
124
128
size,
125
129
primitive_null_density,
126
- ) ) ,
127
- TimeUnit :: Millisecond => Arc :: new ( create_random_temporal_array :: <
128
- TimestampMillisecondType ,
129
- > ( size, primitive_null_density) ) ,
130
- TimeUnit :: Microsecond => Arc :: new ( create_random_temporal_array :: <
131
- TimestampMicrosecondType ,
132
- > ( size, primitive_null_density) ) ,
133
- TimeUnit :: Nanosecond => Arc :: new ( create_random_temporal_array :: <
134
- TimestampNanosecondType ,
135
- > ( size, primitive_null_density) ) ,
136
- }
137
- }
130
+ )
131
+ . with_timezone_opt ( tz. clone ( ) ) ,
132
+ ) ,
133
+ TimeUnit :: Microsecond => Arc :: new (
134
+ create_random_temporal_array :: < TimestampMicrosecondType > (
135
+ size,
136
+ primitive_null_density,
137
+ )
138
+ . with_timezone_opt ( tz. clone ( ) ) ,
139
+ ) ,
140
+ TimeUnit :: Nanosecond => Arc :: new (
141
+ create_random_temporal_array :: < TimestampNanosecondType > (
142
+ size,
143
+ primitive_null_density,
144
+ )
145
+ . with_timezone_opt ( tz. clone ( ) ) ,
146
+ ) ,
147
+ } ,
138
148
Date32 => Arc :: new ( create_random_temporal_array :: < Date32Type > (
139
149
size,
140
150
primitive_null_density,
@@ -519,7 +529,19 @@ mod tests {
519
529
#[ test]
520
530
fn test_create_batch ( ) {
521
531
let size = 32 ;
522
- let fields = vec ! [ Field :: new( "a" , DataType :: Int32 , true ) ] ;
532
+ let fields = vec ! [
533
+ Field :: new( "a" , DataType :: Int32 , true ) ,
534
+ Field :: new(
535
+ "timestamp_without_timezone" ,
536
+ DataType :: Timestamp ( TimeUnit :: Nanosecond , None ) ,
537
+ true ,
538
+ ) ,
539
+ Field :: new(
540
+ "timestamp_with_timezone" ,
541
+ DataType :: Timestamp ( TimeUnit :: Nanosecond , Some ( "UTC" . into( ) ) ) ,
542
+ true ,
543
+ ) ,
544
+ ] ;
523
545
let schema = Schema :: new ( fields) ;
524
546
let schema_ref = Arc :: new ( schema) ;
525
547
let batch = create_random_batch ( schema_ref. clone ( ) , size, 0.35 , 0.7 ) . unwrap ( ) ;
0 commit comments