@@ -18,7 +18,7 @@ use vortex_array::optimizer::ArrayOptimizer;
1818use vortex_array:: optimizer:: rules:: ArrayParentReduceRule ;
1919use vortex_array:: optimizer:: rules:: ParentRuleSet ;
2020use vortex_dtype:: DType ;
21- use vortex_dtype:: datetime:: TemporalMetadata ;
21+ use vortex_dtype:: datetime:: Timestamp ;
2222use vortex_error:: VortexExpect ;
2323use vortex_error:: VortexResult ;
2424
@@ -161,8 +161,8 @@ fn try_extract_days_constant(array: &ArrayRef) -> Option<i64> {
161161 return None ;
162162 } ;
163163
164- let temporal_metadata = TemporalMetadata :: try_from ( ext_dtype . as_ref ( ) ) . ok ( ) ? ;
165- let ts_parts = timestamp:: split ( timestamp, temporal_metadata . time_unit ( ) ) . ok ( ) ?;
164+ let options = ext_dtype . metadata :: < Timestamp > ( ) ;
165+ let ts_parts = timestamp:: split ( timestamp, options . unit ) . ok ( ) ?;
166166
167167 // Only allow pushdown if seconds and subseconds are zero
168168 if ts_parts. seconds != 0 || ts_parts. subseconds != 0 {
@@ -190,8 +190,8 @@ mod tests {
190190 use vortex_array:: optimizer:: ArrayOptimizer ;
191191 use vortex_array:: validity:: Validity ;
192192 use vortex_buffer:: Buffer ;
193- use vortex_buffer:: buffer;
194193 use vortex_dtype:: datetime:: TimeUnit ;
194+ use vortex_dtype:: datetime:: TimestampOptions ;
195195 use vortex_scalar:: Scalar ;
196196
197197 use super :: * ;
@@ -230,12 +230,13 @@ mod tests {
230230 TimeUnit :: Days => panic ! ( "Days not supported" ) ,
231231 } ;
232232 let timestamp = day * SECONDS_PER_DAY * multiplier;
233- let temporal = TemporalArray :: new_timestamp (
234- PrimitiveArray :: new ( buffer ! [ timestamp] , Validity :: NonNullable ) . into_array ( ) ,
235- time_unit,
236- None ,
233+ let scalar = Scalar :: extension :: < Timestamp > (
234+ TimestampOptions {
235+ unit : time_unit,
236+ tz : None ,
237+ } ,
238+ timestamp. into ( ) ,
237239 ) ;
238- let scalar = Scalar :: extension ( temporal. ext_dtype ( ) , timestamp. into ( ) ) ;
239240 ConstantArray :: new ( scalar, len) . into_array ( )
240241 }
241242
@@ -249,12 +250,13 @@ mod tests {
249250 TimeUnit :: Days => panic ! ( "Days not supported" ) ,
250251 } ;
251252 let timestamp = ( day * SECONDS_PER_DAY + seconds) * multiplier;
252- let temporal = TemporalArray :: new_timestamp (
253- PrimitiveArray :: new ( buffer ! [ timestamp] , Validity :: NonNullable ) . into_array ( ) ,
254- time_unit,
255- None ,
253+ let scalar = Scalar :: extension :: < Timestamp > (
254+ TimestampOptions {
255+ unit : time_unit,
256+ tz : None ,
257+ } ,
258+ timestamp. into ( ) ,
256259 ) ;
257- let scalar = Scalar :: extension ( temporal. ext_dtype ( ) , timestamp. into ( ) ) ;
258260 ConstantArray :: new ( scalar, len) . into_array ( )
259261 }
260262
0 commit comments